//#include <sstream>
//#include <iomanip>
//#include <fstream>
//#include <assert.h>
//#include <chrono>
//#include <thread>
//
#include "IO.h"
//#include "Species/SpeciesCollection.h"
//#include "Record/RecordCollection.h"
//#include "Mesh/Mesh.h"
//#include "VtkWriter.h"
//
//#ifdef _WIN32
//#include <direct.h>
//#include <io.h>
//#elif _LINUX
//#include <stdarg.h>
//#include <sys/stat.h>
//#endif
//
//#ifdef _WIN32
//#define ACCESS _access
//#define MKDIR(a) _mkdir((a))
//#elif _LINUX
//#define ACCESS access
//#define MKDIR(a) mkdir((a), 0755)
//#endif
//
//IO::IO(Config* config_, ParallelMPI* pmpi_) :
//    config(config_),
//    pmpi(pmpi_)
//{
//    config->io = this;
//
//    data_file_name = "data/data.h5"; 
//
//    step_output_string = "";
//
//    isFirstTime = true;
//    //speciesCollection = config->speciesCollection;
//
//    iTimePreviousOutput = 0;
//
//    if (config->pmpi->is_master() && config->isWriteVtk && ACCESS("result/vtk", 0) == -1)
//    {
//        MKDIR("result/vtk");
//    }
//
//}
//
//IO::~IO()
//{
//    
//}
//
//void IO::write()
//{
//    if (config->electromagneticFieldType == "electromagnetic")
//    {
//        return;
//    }
//
//    if (config->sim_time->is_time_io())
//    {
//        log_info << "";
//        log_info << "writing io: " << config->sim_time->get_time_string_io();
//        log_info << "";
//    }
//
//
//
//    //log_info << "begin: calAverage";
//    calAverage();
//
//    //log_info << "begin: cal_global";
//    cal_global();
//
//
//    //get electricPotential boundary field from electric_potential global field
//    getElectricPotentialBoundaryField();
//
//
//    writeFields();
//
//    writeSpecies();
//
//
//
//    //log_info << "begin: writeTime";
//    writeTime();
//
//
//    //log_info << "begin: writeRecord";
//    writeRecord();
//
//    //log_info << "end: write";
//
//    //reset depositChargeDensityCurrentStep
//    config->emField->depositChargeDensityCurrentStep->setZero();
//}
//
//
//void IO::add_field(Field<double>* field)
//{
//    fields.push_back(field);
//}
//
//void IO::add_vector_field(Field<FemVector3D>* field)
//{
//    vector_fields.push_back(field);
//}
//
//
//void IO::addBoundaryField(BoundaryFieldCollection<double>* field)
//{
//    boundaryFields.push_back(field);
//}
//
//
//void IO::writeTime()
//{
//    //if(!(pmpi->is_master() && config->sim_time->is_time_io()))
//    //{
//    //    return;
//    //}
//
//    ////write info like time, for restart or other thing
//    //std::ofstream ofs;
//    //ofs.open("result/info.dat", ios::app);
//    //ofs.precision(10);
//
//    //ofs << setw(15) << config->sim_time->get_time_string_io() << setw(15) << config->sim_time->itime << setw(15) << config->sim_time->timeNow;
//    //ofs << "\n";
//
//    //ofs.close();
//}
//
//void IO::reload()
//{
//    
//    if (config->sim_time_param.isReload)
//    {
//        reloadTime();
//
//        //不同进程分别读取，避免内存占用太大
//        for (int iRank = 0; iRank < pmpi->get_size(); iRank++)
//        {
//            if (pmpi->get_rank() == iRank)
//            {
//                reloadSpecies();
//                reloadFields();
//
//                if (config->dimension == 3)
//                {
//                    reloadFiedlBoundaryCondition3d();
//                }
//                else if (config->dimension == 2)
//                {
//                    reloadFiedlBoundaryCondition2d();
//                }
//                
//            }
//            pmpi->barrier();
//        }
//
//
//
//    }
//    
//
//}
//
//void IO::reloadTime()
//{
//    step_output_string = to_string(config->sim_time_param.reloadIOstep);
//    std::string fieldsFileName = "result/fields_" + step_output_string + ".h5";
//
//    hid_t fields_file_id = H5Fopen(fieldsFileName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
//    if (fields_file_id == -1)
//    {
//        log_info << fieldsFileName << " not found";
//        exit(0);
//    }
//
//    hid_t dataset_id = H5Dopen(fields_file_id, "time/itime", H5P_DEFAULT);
//    log_info << "fields_file_id: " << fields_file_id << " " << dataset_id;
//    H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->sim_time->itime));
//    H5Dclose(dataset_id);
//
//
//    dataset_id = H5Dopen(fields_file_id, "time/timeNow", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->sim_time->timeNow));
//    H5Dclose(dataset_id);
//
//    H5Fclose(fields_file_id);
//
//    iTimePreviousOutput = config->sim_time->itime;
//
//    if (config->debugLevel > 0) log_info << "-----reloading time " << step_output_string << " " << config->sim_time->itime << " " << config->sim_time->timeNow;
//
//
//
//    //std::fstream fs;
//    //std::stringstream ss;
//    //std::string line;
//
//    //string filename = "result/info.dat";
//
//    ////if not reload and info.dat exist, delete info.data
//    //if (!(config->isReload) && access(filename.c_str(), 0) == 0)
//    //{
//    //    remove(filename.c_str());
//    //}
//
//    //fs.open(filename, std::ios::in);
//    //if(!fs)
//    //{
//    //    //log_error<<"[GmshMesh.h::GmshMesh] unable open gmsh file: "<<filename;
//    //    return;
//    //}
//
//    //string timeStepIo;
//    //int itime;
//    //double timeNow;
//    //while(getline(fs, line))
//    //{
//    //    ss.clear();
//    //    ss.str(line);
//
//    //    ss >> timeStepIo >> itime >> timeNow;
//    //}
//    //fs.close();
//
//    //step_output_string = timeStepIo;
//    //config->sim_time->itime = itime;
//    //config->sim_time->timeNow = timeNow;
//
//    //iTimePreviousOutput = config->sim_time->itime;
//
//    //if(config->debugLevel > 0) log_info << "-----reloading time " << step_output_string << " " << itime << " " << timeNow;
//}
//
//
//void IO::writeFields()
//{
//    if (!(config->sim_time->is_time_io()))
//    {
//        return;
//    }
//
//
//    if (config->isWriteAllProcess)
//    {
//        writeFieldsHdf5AllProcess();
//    }
//    else
//    {
//        if (config->dimension == 3)
//        {
//            writeFieldsHdf5ToOneFile3d();
//
//            writeBoundaryFieldsHdf5ToOneFile3d();
//        }
//        else if (config->dimension == 2)
//        {
//            writeFieldsHdf5ToOneFile2d();
//
//            //log_info << "aaaa";
//            writeBoundaryFieldsHdf5ToOneFile2d();
//            //log_info << "bbbb";
//        }
//
//    }
//
//    if (config->isWriteVtk)
//    {
//        if (config->isWriteAllProcess)
//        {
//            writeFieldsVtkAllProcess();
//        }
//        else
//        {
//            writeFieldsVtkToOneFile();
//        }
//    }
//
//
//
//}
//
//
//void IO::writeSpecies()
//{
//    if (!(config->sim_time->is_time_io()))
//    {
//        return;
//    }
//
//    if (config->isWriteAllProcess)
//    {
//        writeSpeciesHdf5AllProcess();
//    }
//    else
//    {
//        writeSpeciesHdf5ToOneFile();
//    }
//
//    if (config->isWriteVtk)
//    {
//        if (config->isWriteAllProcess)
//        {
//            writeSpeciesVtkAllProcess();
//        }
//        else
//        {
//            writeSpeciesVtkToOneFile();
//        }
//    }
//
//}
//
//
//void IO::writeFieldsVtkToOneFile()
//{
//    string step_output_string = config->sim_time->get_time_string_io();
//
//    VtkWriter* vtkWriter = new VtkWriter(config, this);
//
//    if (pmpi->is_master())
//    {
//        vtkWriter->writeVtuFieldGlobal(step_output_string);
//    }
//
//    if (pmpi->is_master())
//    {
//        vtkWriter->writeVtpBoundaryFieldGlobal(step_output_string);
//    }
//}
//
//void IO::writeFieldsVtkAllProcess()
//{
//    string step_output_string = config->sim_time->get_time_string_io();
//
//    VtkWriter* vtkWriter = new VtkWriter(config, this);
//    vtkWriter->writeVtuField(step_output_string);
//
//}
//
//void IO::writeSpeciesVtkToOneFile()
//{
//    string step_output_string = config->sim_time->get_time_string_io();
//    VtkWriter* vtkWriter = new VtkWriter(config, this);
//    vtkWriter->writeVtuSpeciesToOneFile(step_output_string);
//}
//
//void IO::writeSpeciesVtkAllProcess()
//{
//    string step_output_string = config->sim_time->get_time_string_io();
//    VtkWriter* vtkWriter = new VtkWriter(config, this);
//    vtkWriter->writeVtuSpecies(step_output_string);
//}
//
//
//
//void IO::writeFieldsHdf5ToOneFile3d()
//{
//    std::string timeString = config->sim_time->get_time_string_io();
//
//    std::string fieldsFileName = "result/fields_" + timeString + ".h5";
//
//    if (pmpi->is_master())
//    {
//        hid_t fields_file_id = H5Fcreate(fieldsFileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//        //========================== write mesh: begin =======================================================================
//        EasyMesh::Mesh* globalMesh = config->mesh->serialMesh;
//
//
//        hid_t domain_datagroup_id = H5Gcreate(fields_file_id, "domain", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        ////write vsType attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 4);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(domain_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "mesh");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsKind attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 12);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsKind", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "unstructured");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsPoints attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 8);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsPoints", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "vertices");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write time attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 12);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsTetrahedrals", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "tetrahedrals");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vertices
//        double* vertices = new double[3 * globalMesh->pointList.size()];
//        for (int iPoint = 0; iPoint < globalMesh->pointList.size(); iPoint++)
//        {
//            vertices[iPoint * 3 + 0] = globalMesh->pointList[iPoint].position[0];
//            vertices[iPoint * 3 + 1] = globalMesh->pointList[iPoint].position[1];
//            vertices[iPoint * 3 + 2] = globalMesh->pointList[iPoint].position[2];
//        }
//
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = globalMesh->pointList.size();
//        dims[1] = 3;
//
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        hid_t dataset_id = H5Dcreate2(domain_datagroup_id, "vertices", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vertices);
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//        delete[] vertices;
//
//        //write tetrahedrals
//        int* tetrahedrals = new int[4 * globalMesh->volumeList.size()];
//        for (int iVolume = 0; iVolume < globalMesh->volumeList.size(); iVolume++)
//        {
//            tetrahedrals[iVolume * 4 + 0] = globalMesh->volumeList[iVolume].pointList[0];
//            tetrahedrals[iVolume * 4 + 1] = globalMesh->volumeList[iVolume].pointList[1];
//            tetrahedrals[iVolume * 4 + 2] = globalMesh->volumeList[iVolume].pointList[2];
//            tetrahedrals[iVolume * 4 + 3] = globalMesh->volumeList[iVolume].pointList[3];
//        }
//
//        n_dim = 2;
//        dims[0] = globalMesh->volumeList.size();
//        dims[1] = 4;
//
//        dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        dataset_id = H5Dcreate2(domain_datagroup_id, "tetrahedrals", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tetrahedrals);
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//        delete[] tetrahedrals;
//
//        H5Gclose(domain_datagroup_id);
//        //========================== write mesh: end =======================================================================
//
//
//        //write global scalar data: debugLevel > 1
//        if (config->debugLevel > 1)
//        {
//            for (int iField = 0; iField < fields.size(); iField++)
//            {
//                //write data
//                int n_dim = 1;
//                hsize_t dims[1];
//                dims[0] = globalMesh->pointList.size();
//                hid_t dataspace_id;
//                hid_t dataset_id;
//
//                if (fields[iField]->name == "electric_potential" || fields[iField]->name == "electric_field" || fields[iField]->name == "magneticField" || fields[iField]->name == "depositChargeDensity")
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (fields[iField]->name + "_average").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_average_global.data());
//                }
//                else
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (fields[iField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_global.data());
//                }
//
//
//
//                H5Sclose(dataspace_id);
//
//                //write attribute
//                ////write vsType attributes: string(char) type
//                hid_t aid = H5Screate(H5S_SCALAR);
//                hid_t atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 8);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "variable");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsKind attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 6);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "domain");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsPoints attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 5);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "nodal");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                H5Dclose(dataset_id);
//            }
//        }
//
//
//
//        //write global scalar data: debugLevel <= 1
//        for (int iField = 0; iField < fields.size(); iField++)
//        {
//            //write data
//            int n_dim = 1;
//            hsize_t dims[1];
//            dims[0] = globalMesh->pointList.size();
//            hid_t dataspace_id;
//            hid_t dataset_id;
//
//            if (fields[iField]->name == "electric_potential" || fields[iField]->name == "electric_field" || fields[iField]->name == "magneticField" || fields[iField]->name == "depositChargeDensity")
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, fields[iField]->name.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_global.data());
//            }
//            else
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, fields[iField]->name.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_average_global.data());
//            }
//
//
//            H5Sclose(dataspace_id);
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "nodal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//        }
//
//
//        //create derivedVariables for vector fields
//        hid_t derivedVariables_datagroup_id = H5Gcreate(fields_file_id, "derivedVariables", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        //write vsType attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 6);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(derivedVariables_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "vsVars");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write global vector data
//        if (config->debugLevel > 1)
//        {
//            for (int iField = 0; iField < vector_fields.size(); iField++)
//            {
//                //write data
//                double* vectorData = new double[3 * vector_fields[iField]->data_global.size()];
//                for (int iPoint = 0; iPoint < vector_fields[iField]->data_global.size(); iPoint++)
//                {
//                    vectorData[iPoint * 3 + 0] = vector_fields[iField]->data_global[iPoint].x[0];
//                    vectorData[iPoint * 3 + 1] = vector_fields[iField]->data_global[iPoint].x[1];
//                    vectorData[iPoint * 3 + 2] = vector_fields[iField]->data_global[iPoint].x[2];
//                }
//
//                int n_dim = 2;
//                hsize_t dims[2];
//                dims[0] = globalMesh->pointList.size();
//                dims[1] = 3;
//                hid_t dataspace_id;
//                hid_t dataset_id;
//
//                if (vector_fields[iField]->name == "electric_potential" || vector_fields[iField]->name == "electric_field" || vector_fields[iField]->name == "magneticField")
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name + "_average").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_average_global.data());
//                }
//                else
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_global.data());
//                }
//
//                H5Sclose(dataspace_id);
//                delete[] vectorData;
//
//                //write attribute
//                ////write vsType attributes: string(char) type
//                hid_t aid = H5Screate(H5S_SCALAR);
//                hid_t atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 8);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "variable");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsKind attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 6);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "domain");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsPoints attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 5);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "nodal");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsLabels attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 7);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsLabels ", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "x, y, z");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                H5Dclose(dataset_id);
//
//
//                //write derivedVariables attributes: string(char) type
//                if (vector_fields[iField]->name == "electric_potential" || vector_fields[iField]->name == "electric_field" || vector_fields[iField]->name == "magneticField")
//                {
//                    std::string vectorComponentsString;
//                    vectorComponentsString += "{<" + (vector_fields[iField]->name + "_average") + "_0>,<" + (vector_fields[iField]->name + "_average") + "_1>,<" + (vector_fields[iField]->name + "_average") + "_2>}";
//                    aid = H5Screate(H5S_SCALAR);
//                    atype = H5Tcopy(H5T_C_S1);
//                    H5Tset_size(atype, vectorComponentsString.length());
//                    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                    attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name + "_average").c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Awrite(attr, atype, vectorComponentsString.c_str());
//                    H5Sclose(aid);
//                    H5Tclose(atype);
//                    H5Aclose(attr);
//                }
//                else
//                {
//                    std::string vectorComponentsString;
//                    vectorComponentsString += "{<" + (vector_fields[iField]->name + "_OneStep") + "_0>,<" + (vector_fields[iField]->name + "_OneStep") + "_1>,<" + (vector_fields[iField]->name + "_OneStep") + "_2>}";
//                    aid = H5Screate(H5S_SCALAR);
//                    atype = H5Tcopy(H5T_C_S1);
//                    H5Tset_size(atype, vectorComponentsString.length());
//                    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                    attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name + "_OneStep").c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Awrite(attr, atype, vectorComponentsString.c_str());
//                    H5Sclose(aid);
//                    H5Tclose(atype);
//                    H5Aclose(attr);
//                }
//
//            }
//        }
//
//
//        //write global vector data: debugLevel <= 1
//        for (int iField = 0; iField < vector_fields.size(); iField++)
//        {
//            //write data
//            double* vectorData = new double[3 * vector_fields[iField]->data_average_global.size()];
//            for (int iPoint = 0; iPoint < vector_fields[iField]->data_average_global.size(); iPoint++)
//            {
//                vectorData[iPoint * 3 + 0] = vector_fields[iField]->data_average_global[iPoint].x[0];
//                vectorData[iPoint * 3 + 1] = vector_fields[iField]->data_average_global[iPoint].x[1];
//                vectorData[iPoint * 3 + 2] = vector_fields[iField]->data_average_global[iPoint].x[2];
//            }
//
//            int n_dim = 2;
//            hsize_t dims[2];
//            dims[0] = globalMesh->pointList.size();
//            dims[1] = 3;
//            hid_t dataspace_id;
//            hid_t dataset_id;
//
//
//            if (vector_fields[iField]->name == "electric_potential" || vector_fields[iField]->name == "electric_field" || vector_fields[iField]->name == "magneticField")
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_global.data());
//            }
//            else
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_average_global.data());
//            }
//
//            H5Sclose(dataspace_id);
//            delete[] vectorData;
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "nodal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsLabels attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsLabels ", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "x,y,z");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//
//            //write derivedVariables attributes: string(char) type
//            std::string vectorComponentsString;
//            vectorComponentsString += "{<" + (vector_fields[iField]->name) + "_0>,<" + (vector_fields[iField]->name) + "_1>,<" + (vector_fields[iField]->name) + "_2>}";
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, vectorComponentsString.length());
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name).c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, vectorComponentsString.c_str());
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//        }
//
//        H5Gclose(derivedVariables_datagroup_id);
//
//
//        //====================写出ElectroMagneticField的accelerateFactorK等属性，用于reload: begin============================================
//        auto emField = config->emField;
//
//        hid_t emField_group_id = H5Gcreate(fields_file_id, "EMfieldParameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        hsize_t dim1d[1];
//
//        //write accumlatedCharge
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accumlatedCharge", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accumlatedCharge));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write accumlatedChargeInAccelerateStep0
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accumlatedChargeInAccelerateStep0", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accumlatedChargeInAccelerateStep0));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write accumlatedChargeInAccelerateStep1
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accumlatedChargeInAccelerateStep1", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accumlatedChargeInAccelerateStep1));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write accelerateFactorK
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accelerateFactorK", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accelerateFactorK));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(emField_group_id);
//        //====================写出ElectroMagneticField的accelerateFactorK等属性，用于reload: end============================================
//
//
//        //====================写出time相关参数，用于reload: begin============================================
//        hid_t time_group_id = H5Gcreate(fields_file_id, "time", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        //write itime
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(time_group_id, "itime", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->sim_time->itime));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write timeNow
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(time_group_id, "timeNow", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->sim_time->timeNow));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(time_group_id);
//        //====================写出time相关参数，用于reload: end============================================
//
//
//
//        H5Fclose(fields_file_id);
//
//    }
//    pmpi->barrier();
//}
//
//void IO::writeFieldsHdf5ToOneFile2d()
//{
//    std::string timeString = config->sim_time->get_time_string_io();
//
//    std::string fieldsFileName = "result/fields_" + timeString + ".h5";
//
//    if (pmpi->is_master())
//    {
//        hid_t fields_file_id = H5Fcreate(fieldsFileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//        //========================== write mesh: begin =======================================================================
//        EasyMesh::Mesh* globalMesh = config->mesh->serialMesh;
//
//
//        hid_t domain_datagroup_id = H5Gcreate(fields_file_id, "domain", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        ////write vsType attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 4);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(domain_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "mesh");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsKind attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 12);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsKind", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "unstructured");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsPoints attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 8);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsPoints", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "vertices");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write time attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 9);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsTriangles", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "triangles");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vertices
//        double* vertices = new double[3 * globalMesh->pointList.size()];
//        for (int iPoint = 0; iPoint < globalMesh->pointList.size(); iPoint++)
//        {
//            vertices[iPoint * 3 + 0] = globalMesh->pointList[iPoint].position[0];
//            vertices[iPoint * 3 + 1] = globalMesh->pointList[iPoint].position[1];
//            vertices[iPoint * 3 + 2] = globalMesh->pointList[iPoint].position[2];
//        }
//
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = globalMesh->pointList.size();
//        dims[1] = 3;
//
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        hid_t dataset_id = H5Dcreate2(domain_datagroup_id, "vertices", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vertices);
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//        delete[] vertices;
//
//        //write triangles
//        int* triangles = new int[3 * globalMesh->faceList.size()];
//        for (int iFace = 0; iFace < globalMesh->faceList.size(); iFace++)
//        {
//            triangles[iFace * 3 + 0] = globalMesh->faceList[iFace].pointList[0];
//            triangles[iFace * 3 + 1] = globalMesh->faceList[iFace].pointList[1];
//            triangles[iFace * 3 + 2] = globalMesh->faceList[iFace].pointList[2];
//        }
//
//        n_dim = 2;
//        dims[0] = globalMesh->faceList.size();
//        dims[1] = 3;
//
//        dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        dataset_id = H5Dcreate2(domain_datagroup_id, "triangles", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, triangles);
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//        delete[] triangles;
//
//        H5Gclose(domain_datagroup_id);
//        //========================== write mesh: end =======================================================================
//
//
//        //write global scalar data: debugLeve > 1
//        if (config->debugLevel > 1)
//        {
//            for (int iField = 0; iField < fields.size(); iField++)
//            {
//                //write data
//                int n_dim = 1;
//                hsize_t dims[1];
//                dims[0] = globalMesh->pointList.size();
//                hid_t dataspace_id;
//                hid_t dataset_id;
//
//                if (fields[iField]->name == "electric_potential" || fields[iField]->name == "electric_field" || fields[iField]->name == "magneticField" || fields[iField]->name == "depositChargeDensity")
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (fields[iField]->name + "_average").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_average_global.data());
//                }
//                else
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (fields[iField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_global.data());
//                }
//
//                H5Sclose(dataspace_id);
//
//                //write attribute
//                ////write vsType attributes: string(char) type
//                hid_t aid = H5Screate(H5S_SCALAR);
//                hid_t atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 8);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "variable");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsKind attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 6);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "domain");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsPoints attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 5);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "nodal");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                H5Dclose(dataset_id);
//            }
//        }
//
//
//
//        //write global scalar data: debugLevel <= 1
//        for (int iField = 0; iField < fields.size(); iField++)
//        {
//            //write data
//            int n_dim = 1;
//            hsize_t dims[1];
//            dims[0] = globalMesh->pointList.size();
//            hid_t dataspace_id;
//            hid_t dataset_id;
//
//            if (fields[iField]->name == "electric_potential" || fields[iField]->name == "electric_field" || fields[iField]->name == "magneticField" || fields[iField]->name == "depositChargeDensity")
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, fields[iField]->name.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_global.data());
//            }
//            else
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, fields[iField]->name.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_average_global.data());
//            }
//
//            H5Sclose(dataspace_id);
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "nodal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//        }
//
//
//        //create derivedVariables for vector fields
//        hid_t derivedVariables_datagroup_id = H5Gcreate(fields_file_id, "derivedVariables", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        //write vsType attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 6);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(derivedVariables_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "vsVars");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write global vector data: debugLevel > 1
//        if (config->debugLevel > 1)
//        {
//            for (int iField = 0; iField < vector_fields.size(); iField++)
//            {
//                //write data
//                double* vectorData = new double[3 * vector_fields[iField]->data_global.size()];
//                for (int iPoint = 0; iPoint < vector_fields[iField]->data_global.size(); iPoint++)
//                {
//                    vectorData[iPoint * 3 + 0] = vector_fields[iField]->data_global[iPoint].x[0];
//                    vectorData[iPoint * 3 + 1] = vector_fields[iField]->data_global[iPoint].x[1];
//                    vectorData[iPoint * 3 + 2] = vector_fields[iField]->data_global[iPoint].x[2];
//                }
//
//                int n_dim = 2;
//                hsize_t dims[2];
//                dims[0] = globalMesh->pointList.size();
//                dims[1] = 3;
//                hid_t dataspace_id;
//                hid_t dataset_id;
//
//                if (vector_fields[iField]->name == "electric_potential" || vector_fields[iField]->name == "electric_field" || vector_fields[iField]->name == "magneticField")
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name + "_average").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_average_global.data());
//                }
//                else
//                {
//                    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                    dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                    //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_global.data());
//                }
//
//                H5Sclose(dataspace_id);
//                delete[] vectorData;
//
//                //write attribute
//                ////write vsType attributes: string(char) type
//                hid_t aid = H5Screate(H5S_SCALAR);
//                hid_t atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 8);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "variable");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsKind attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 6);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "domain");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsPoints attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 5);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "nodal");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsLabels attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 7);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsLabels ", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "x, y, z");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                H5Dclose(dataset_id);
//
//
//                //write derivedVariables attributes: string(char) type
//                if (vector_fields[iField]->name == "electric_potential" || vector_fields[iField]->name == "electric_field" || vector_fields[iField]->name == "magneticField")
//                {
//                    std::string vectorComponentsString;
//                    vectorComponentsString += "{<" + (vector_fields[iField]->name + "_average") + "_0>,<" + (vector_fields[iField]->name + "_average") + "_1>,<" + (vector_fields[iField]->name + "_average") + "_2>}";
//                    aid = H5Screate(H5S_SCALAR);
//                    atype = H5Tcopy(H5T_C_S1);
//                    H5Tset_size(atype, vectorComponentsString.length());
//                    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                    attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name + "_average").c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Awrite(attr, atype, vectorComponentsString.c_str());
//                    H5Sclose(aid);
//                    H5Tclose(atype);
//                    H5Aclose(attr);
//                }
//                else
//                {
//                    std::string vectorComponentsString;
//                    vectorComponentsString += "{<" + (vector_fields[iField]->name + "_OneStep") + "_0>,<" + (vector_fields[iField]->name + "_OneStep") + "_1>,<" + (vector_fields[iField]->name + "_OneStep") + "_2>}";
//                    aid = H5Screate(H5S_SCALAR);
//                    atype = H5Tcopy(H5T_C_S1);
//                    H5Tset_size(atype, vectorComponentsString.length());
//                    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                    attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name + "_OneStep").c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                    H5Awrite(attr, atype, vectorComponentsString.c_str());
//                    H5Sclose(aid);
//                    H5Tclose(atype);
//                    H5Aclose(attr);
//                }
//
//            }
//        }
//
//
//        //write global vector data: debugLevel <= 1
//        for (int iField = 0; iField < vector_fields.size(); iField++)
//        {
//            //write data
//            double* vectorData = new double[3 * vector_fields[iField]->data_average_global.size()];
//            for (int iPoint = 0; iPoint < vector_fields[iField]->data_average_global.size(); iPoint++)
//            {
//                vectorData[iPoint * 3 + 0] = vector_fields[iField]->data_average_global[iPoint].x[0];
//                vectorData[iPoint * 3 + 1] = vector_fields[iField]->data_average_global[iPoint].x[1];
//                vectorData[iPoint * 3 + 2] = vector_fields[iField]->data_average_global[iPoint].x[2];
//            }
//
//            int n_dim = 2;
//            hsize_t dims[2];
//            dims[0] = globalMesh->pointList.size();
//            dims[1] = 3;
//            hid_t dataspace_id;
//            hid_t dataset_id;
//
//            if (vector_fields[iField]->name == "electric_potential" || vector_fields[iField]->name == "electric_field" || vector_fields[iField]->name == "magneticField")
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_global.data());
//            }
//            else
//            {
//                dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_average_global.data());
//            }
//
//            H5Sclose(dataspace_id);
//            delete[] vectorData;
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "nodal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsLabels attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsLabels ", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "x,y,z");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//
//            //write derivedVariables attributes: string(char) type
//            std::string vectorComponentsString;
//            vectorComponentsString += "{<" + (vector_fields[iField]->name) + "_0>,<" + (vector_fields[iField]->name) + "_1>,<" + (vector_fields[iField]->name) + "_2>}";
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, vectorComponentsString.length());
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name).c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, vectorComponentsString.c_str());
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//        }
//
//        H5Gclose(derivedVariables_datagroup_id);
//
//
//        //====================写出ElectroMagneticField的accelerateFactorK等属性，用于reload: begin============================================
//        auto emField = config->emField;
//
//        hid_t emField_group_id = H5Gcreate(fields_file_id, "EMfieldParameters", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        hsize_t dim1d[1];
//
//        //write accumlatedCharge
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accumlatedCharge", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accumlatedCharge));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write accumlatedChargeInAccelerateStep0
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accumlatedChargeInAccelerateStep0", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accumlatedChargeInAccelerateStep0));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write accumlatedChargeInAccelerateStep1
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accumlatedChargeInAccelerateStep1", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accumlatedChargeInAccelerateStep1));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write accelerateFactorK
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(emField_group_id, "accelerateFactorK", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(emField->accelerateFactorK));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(emField_group_id);
//        //====================写出ElectroMagneticField的accelerateFactorK等属性，用于reload: end============================================
//
//        //====================写出time相关参数，用于reload: begin============================================
//        hid_t time_group_id = H5Gcreate(fields_file_id, "time", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        //write itime
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(time_group_id, "itime", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->sim_time->itime));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write timeNow
//        n_dim = 1;
//        dim1d[0] = 1;
//
//        dataspace_id = H5Screate_simple(n_dim, dim1d, NULL);
//        dataset_id = H5Dcreate2(time_group_id, "timeNow", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->sim_time->timeNow));
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(time_group_id);
//        //====================写出time相关参数，用于reload: end============================================
//
//
//        H5Fclose(fields_file_id);
//
//    }
//    pmpi->barrier();
//}
//
//
//
//void IO::writeFieldsHdf5AllProcess()
//{
//    std::string timeString = config->sim_time->get_time_string_io();
//
//    std::string fieldsFileName = "result/fieldsProc" + std::to_string(config->pmpi->get_rank()) + "_" + timeString + ".h5";
//
//    hid_t fields_file_id = H5Fcreate(fieldsFileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//    //========================== write mesh: begin =======================================================================
//    EasyMesh::ParallelMesh* mesh = config->mesh;
//
//
//    hid_t domain_datagroup_id = H5Gcreate(fields_file_id, "domain", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//    ////write vsType attributes: string(char) type
//    hid_t aid = H5Screate(H5S_SCALAR);
//    hid_t atype = H5Tcopy(H5T_C_S1);
//    H5Tset_size(atype, 4);
//    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//    hid_t attr = H5Acreate2(domain_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//    H5Awrite(attr, atype, "mesh");
//    H5Sclose(aid);
//    H5Tclose(atype);
//    H5Aclose(attr);
//
//    //write vsKind attributes: string(char) type
//    aid = H5Screate(H5S_SCALAR);
//    atype = H5Tcopy(H5T_C_S1);
//    H5Tset_size(atype, 12);
//    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//    attr = H5Acreate2(domain_datagroup_id, "vsKind", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//    H5Awrite(attr, atype, "unstructured");
//    H5Sclose(aid);
//    H5Tclose(atype);
//    H5Aclose(attr);
//
//    //write vsPoints attributes: string(char) type
//    aid = H5Screate(H5S_SCALAR);
//    atype = H5Tcopy(H5T_C_S1);
//    H5Tset_size(atype, 8);
//    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//    attr = H5Acreate2(domain_datagroup_id, "vsPoints", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//    H5Awrite(attr, atype, "vertices");
//    H5Sclose(aid);
//    H5Tclose(atype);
//    H5Aclose(attr);
//
//    //write time attributes: string(char) type
//    aid = H5Screate(H5S_SCALAR);
//    atype = H5Tcopy(H5T_C_S1);
//    H5Tset_size(atype, 12);
//    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//    attr = H5Acreate2(domain_datagroup_id, "vsTetrahedrals", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//    H5Awrite(attr, atype, "tetrahedrals");
//    H5Sclose(aid);
//    H5Tclose(atype);
//    H5Aclose(attr);
//
//    //write vertices
//    double* vertices = new double[3 * mesh->pointList.size()];
//    for (int iPoint = 0; iPoint < mesh->pointList.size(); iPoint++)
//    {
//        vertices[iPoint * 3 + 0] = mesh->pointList[iPoint].position[0];
//        vertices[iPoint * 3 + 1] = mesh->pointList[iPoint].position[1];
//        vertices[iPoint * 3 + 2] = mesh->pointList[iPoint].position[2];
//    }
//
//    int n_dim = 2;
//    hsize_t dims[2];
//    dims[0] = mesh->pointList.size();
//    dims[1] = 3;
//
//    hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//    hid_t dataset_id = H5Dcreate2(domain_datagroup_id, "vertices", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vertices);
//    H5Sclose(dataspace_id);
//    H5Dclose(dataset_id);
//    delete[] vertices;
//
//    //write tetrahedrals
//    int* tetrahedrals = new int[4 * mesh->volumeList.size()];
//    for (int iVolume = 0; iVolume < mesh->volumeList.size(); iVolume++)
//    {
//        tetrahedrals[iVolume * 4 + 0] = mesh->volumeList[iVolume].pointList[0];
//        tetrahedrals[iVolume * 4 + 1] = mesh->volumeList[iVolume].pointList[1];
//        tetrahedrals[iVolume * 4 + 2] = mesh->volumeList[iVolume].pointList[2];
//        tetrahedrals[iVolume * 4 + 3] = mesh->volumeList[iVolume].pointList[3];
//    }
//
//    n_dim = 2;
//    dims[0] = mesh->volumeList.size();
//    dims[1] = 4;
//
//    dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//    dataset_id = H5Dcreate2(domain_datagroup_id, "tetrahedrals", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//    H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tetrahedrals);
//    H5Sclose(dataspace_id);
//    H5Dclose(dataset_id);
//    delete[] tetrahedrals;
//
//    H5Gclose(domain_datagroup_id);
//    //========================== write mesh: end =======================================================================
//
//
//    //write scalar data
//    if (config->debugLevel > 1)
//    {
//        for (int iField = 0; iField < fields.size(); iField++)
//        {
//            //write data
//            int n_dim = 1;
//            hsize_t dims[1];
//            dims[0] = mesh->pointList.size();
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//            hid_t dataset_id = H5Dcreate2(fields_file_id, (fields[iField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data.data());
//            H5Sclose(dataspace_id);
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "nodal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//        }
//    }
//
//
//
//    //write averge scalar data
//    for (int iField = 0; iField < fields.size(); iField++)
//    {
//        //write data
//        int n_dim = 1;
//        hsize_t dims[1];
//        dims[0] = mesh->pointList.size();
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//        hid_t dataset_id = H5Dcreate2(fields_file_id, fields[iField]->name.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fields[iField]->data_average.data());
//        H5Sclose(dataspace_id);
//
//        //write attribute
//        ////write vsType attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 8);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "variable");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsKind attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 6);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "domain");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsPoints attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 5);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "nodal");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        H5Dclose(dataset_id);
//    }
//
//
//    //create derivedVariables for vector fields
//    hid_t derivedVariables_datagroup_id = H5Gcreate(fields_file_id, "derivedVariables", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//    //write vsType attributes: string(char) type
//    aid = H5Screate(H5S_SCALAR);
//    atype = H5Tcopy(H5T_C_S1);
//    H5Tset_size(atype, 6);
//    H5Tset_strpad(atype, H5T_STR_NULLTERM);
//    attr = H5Acreate2(derivedVariables_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//    H5Awrite(attr, atype, "vsVars");
//    H5Sclose(aid);
//    H5Tclose(atype);
//    H5Aclose(attr);
//
//    //write global vector data
//    if (config->debugLevel > 1)
//    {
//        for (int iField = 0; iField < vector_fields.size(); iField++)
//        {
//            //write data
//            int n_dim = 2;
//            hsize_t dims[2];
//            dims[0] = mesh->pointList.size();
//            dims[1] = 3;
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//            hid_t dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data.data());
//            H5Sclose(dataspace_id);
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "nodal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsLabels attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 7);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsLabels ", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "x, y, z");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//
//
//            //write derivedVariables attributes: string(char) type
//            std::string vectorComponentsString;
//            vectorComponentsString += "{<" + (vector_fields[iField]->name + "_OneStep") + "_0>,<" + (vector_fields[iField]->name + "_OneStep") + "_1>,<" + (vector_fields[iField]->name + "_OneStep") + "_2>}";
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, vectorComponentsString.length());
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name + "_OneStep").c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, vectorComponentsString.c_str());
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//        }
//    }
//
//
//    //write average vector data
//    for (int iField = 0; iField < vector_fields.size(); iField++)
//    {
//        //write data
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = mesh->pointList.size();
//        dims[1] = 3;
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//        hid_t dataset_id = H5Dcreate2(fields_file_id, (vector_fields[iField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        //H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vectorData);
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, vector_fields[iField]->data_average.data());
//        H5Sclose(dataspace_id);
//
//        //write attribute
//        ////write vsType attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 8);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "variable");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsKind attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 6);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "domain");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsPoints attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 5);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "nodal");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsLabels attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 5);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsLabels ", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "x,y,z");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        H5Dclose(dataset_id);
//
//        //write derivedVariables attributes: string(char) type
//        std::string vectorComponentsString;
//        vectorComponentsString += "{<" + (vector_fields[iField]->name) + "_0>,<" + (vector_fields[iField]->name) + "_1>,<" + (vector_fields[iField]->name) + "_2>}";
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, vectorComponentsString.length());
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(derivedVariables_datagroup_id, (vector_fields[iField]->name).c_str(), atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, vectorComponentsString.c_str());
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//    }
//
//    H5Gclose(derivedVariables_datagroup_id);
//
//    H5Fclose(fields_file_id);
//
//    pmpi->barrier();
//}
//
//void IO::writeBoundaryFieldsHdf5ToOneFile3d()
//{
//    if (config->pmpi->is_master())
//    {
//        std::string timeString = config->sim_time->get_time_string_io();
//
//        EasyMesh::ParallelMesh* localMesh = static_cast<EasyMesh::ParallelMesh*>(config->mesh);
//        EasyMesh::Mesh* globalMesh = localMesh->serialMesh;
//
//        std::string hdf5FileName = "result/boundaryField_" + timeString + ".h5";
//
//        //create boundary mesh
//        if (config->debugLevel > 1) log_info << "write boundary fields: create boundary mesh begin";
//        std::vector<double> boundaryMeshPointList;
//        std::vector<int> boundaryMeshFaceList;
//        std::map<int, int> globalToLocalPointMap;
//
//        int iPointLocal = 0;
//        for (auto iter = globalMesh->faceGroupMap.begin(); iter != globalMesh->faceGroupMap.end(); iter++)
//        {
//            auto faceGroupName = iter->first;
//            auto& faceGroup = iter->second;
//            if (config->debugLevel > 1) log_info << "faceGroup name: " << faceGroupName;
//
//            for (int i = 0; i < faceGroup.faceList.size(); i++)
//            {
//                int iFace = faceGroup.faceList[i];
//                EasyMesh::Face& face = globalMesh->faceList[iFace];
//                //log_info << "========= iFace " << globalMesh->faceList.size() << " " << iFace;
//                for (int iPoint = 0; iPoint < 3; iPoint++)
//                {
//                    int iPointGlobal = face.pointList[iPoint];
//                    //log_info << "------------- iPointGlobal " << globalMesh->pointList.size() << " " << iPointGlobal;
//                    auto iter = globalToLocalPointMap.find(iPointGlobal);
//                    if (iter == globalToLocalPointMap.end())
//                    {
//                        globalToLocalPointMap[iPointGlobal] = iPointLocal;
//                        boundaryMeshPointList.push_back(globalMesh->pointList[iPointGlobal].position[0]);
//                        boundaryMeshPointList.push_back(globalMesh->pointList[iPointGlobal].position[1]);
//                        boundaryMeshPointList.push_back(globalMesh->pointList[iPointGlobal].position[2]);
//                        iPointLocal++;
//                    }
//
//                    boundaryMeshFaceList.push_back(globalToLocalPointMap[iPointGlobal]);
//                }
//            }
//        }
//        //log_info << "----------- face number: " << boundaryMeshFaceList.size() / 3;
//        if (config->debugLevel > 1) log_info << "write boundary fields: create boundary mesh end";
//
//
//        hid_t fields_file_id = H5Fcreate(hdf5FileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//        //write boundary mesh
//        //========================== write mesh: begin =======================================================================
//        if (config->debugLevel > 1) log_info << "write boundary fields: write mesh begin";
//        hid_t domain_datagroup_id = H5Gcreate(fields_file_id, "domain", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        ////write vsType attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 4);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(domain_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "mesh");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsKind attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 12);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsKind", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "unstructured");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsPoints attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 8);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsPoints", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "vertices");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write time attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 12);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsTriangles", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "triangles");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vertices
//
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = boundaryMeshPointList.size() / 3;
//        dims[1] = 3;
//
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        hid_t dataset_id = H5Dcreate2(domain_datagroup_id, "vertices", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryMeshPointList.data());
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write triangles
//
//        n_dim = 2;
//        dims[0] = boundaryMeshFaceList.size() / 3;
//        dims[1] = 3;
//
//        dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        dataset_id = H5Dcreate2(domain_datagroup_id, "triangles", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryMeshFaceList.data());
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(domain_datagroup_id);
//        if (config->debugLevel > 1) log_info << "write boundary fields: write mesh end";
//        //========================== write mesh: end =======================================================================
//
//
//        //write boundary global scalar data
//        if (config->debugLevel > 1)
//        {
//            if (config->debugLevel > 1) log_info << "write boundary fields: write one step field begin";
//            for (int iBoundaryField = 0; iBoundaryField < boundaryFields.size(); iBoundaryField++)
//            {
//                //write data
//                std::vector<double> boundaryData;
//                for (auto iter = globalMesh->faceGroupMap.begin(); iter != globalMesh->faceGroupMap.end(); iter++)
//                {
//                    auto faceGroupName = iter->first;
//
//                    if (faceGroupName == "parallelFace")
//                    {
//                        continue;
//                    }
//
//                    if (faceGroupName == "")
//                    {
//                        //临时跳过这个问题，后续要检查在哪里增加了空的faceGroup
//                        log_error << "no faceGroupName";
//                        continue;
//                    }
//                    //if (config->debugLevel > 1) log_info << faceGroupName << " begin";
//
//                    auto& boundaryField = boundaryFields[iBoundaryField]->boundaryFieldMap.find(faceGroupName)->second;
//                    for (int iFace = 0; iFace < boundaryField.globalSize(); iFace++)
//                    {
//                        boundaryData.push_back(boundaryField.data_global[iFace]);
//                    }
//                    //if (config->debugLevel > 1) log_info << faceGroupName << " end";
//
//                }
//                //log_info << "--------------- boundary data size: " << boundaryData.size();
//
//
//                int n_dim = 1;
//                hsize_t dims[1];
//                dims[0] = boundaryMeshFaceList.size() / 3;
//                hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                hid_t dataset_id = H5Dcreate2(fields_file_id, (boundaryFields[iBoundaryField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryData.data());
//                H5Sclose(dataspace_id);
//
//
//
//                //write attribute
//                ////write vsType attributes: string(char) type
//                hid_t aid = H5Screate(H5S_SCALAR);
//                hid_t atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 8);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "variable");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsKind attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 6);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "domain");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsPoints attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 5);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "zonal");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                H5Dclose(dataset_id);
//            }
//            if (config->debugLevel > 1) log_info << "write boundary fields: write one step field end";
//        }
//
//
//        //write boundary average global scalar data
//        if (config->debugLevel > 1) log_info << "write boundary fields: write average field begin";
//        for (int iBoundaryField = 0; iBoundaryField < boundaryFields.size(); iBoundaryField++)
//        {
//            //write data
//            std::vector<double> boundaryData;
//            for (auto iter = globalMesh->faceGroupMap.begin(); iter != globalMesh->faceGroupMap.end(); iter++)
//            {
//                auto faceGroupName = iter->first;
//
//                if (faceGroupName == "parallelFace")
//                {
//                    continue;
//                }
//
//                if (faceGroupName == "")
//                {
//                    //临时跳过这个问题，后续要检查在哪里增加了空的faceGroup
//                    log_error << "no faceGroupName";
//                    continue;
//                }
//                //if (config->debugLevel > 1) log_info << faceGroupName << " begin";
//
//                auto& boundaryField = boundaryFields[iBoundaryField]->boundaryFieldMap.find(faceGroupName)->second;
//                for (int iFace = 0; iFace < boundaryField.globalSize(); iFace++)
//                {
//                    boundaryData.push_back(boundaryField.data_average_global[iFace]);
//                }
//                //if (config->debugLevel > 1) log_info << faceGroupName << " end";
//
//            }
//
//
//            int n_dim = 1;
//            hsize_t dims[1];
//            dims[0] = boundaryMeshFaceList.size() / 3;
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//            hid_t dataset_id = H5Dcreate2(fields_file_id, (boundaryFields[iBoundaryField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryData.data());
//            H5Sclose(dataspace_id);
//
//
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "zonal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//        }
//        if (config->debugLevel > 1) log_info << "write boundary fields: write average field end";
//
//
//
//        //========================= write field boundary condition: begin =======================================================
//        hid_t fbc_datagroup_id = H5Gcreate(fields_file_id, "fiedlBoundaryCondition", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        for (auto iter = globalMesh->faceGroupMap.begin(); iter != globalMesh->faceGroupMap.end(); iter++)
//        {
//            auto faceGroupName = iter->first;
//
//            hid_t fbcEach_datagroup_id = H5Gcreate(fbc_datagroup_id, faceGroupName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//            auto fbcIter = config->emField->electric_potential->fbc_param.find(faceGroupName);
//
//            //write accumlatedCharge
//            n_dim = 1;
//            hsize_t dims1d[1];
//            dims1d[0] = 1;
//
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            hid_t dataset_id = H5Dcreate2(fbcEach_datagroup_id, "accumlatedCharge", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->accumlatedCharge));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//            
//
//            //write absorbedCharge
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCharge", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCharge));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCurrent
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCurrent", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrent));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCurrentAverage
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCurrentAverage", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrentAverage));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCurrentQueue
//            std::vector<double> absorbedCurrentVector;
//            while (!fbcIter->second->absorbedCurrentQueue.empty())
//            {
//                absorbedCurrentVector.push_back(fbcIter->second->absorbedCurrentQueue.front());
//                fbcIter->second->absorbedCurrentQueue.pop();
//            }
//            for (int i = 0; i < absorbedCurrentVector.size(); i++)
//            {
//                fbcIter->second->absorbedCurrentQueue.push(absorbedCurrentVector[i]);
//            }
//
//            n_dim = 1;
//            dims1d[0] = absorbedCurrentVector.size();
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCurrentQueue", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, absorbedCurrentVector.data());
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//            //write electricForce
//            n_dim = 1;
//            dims1d[0] = 3;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "electricForce", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbcIter->second->electricForce);
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//            //write electricPotential
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "electricPotential", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->fbc_value));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            H5Gclose(fbcEach_datagroup_id);
//
//        }
//        H5Gclose(fbc_datagroup_id);
//
//        //========================= write field boundary condition: end =======================================================
//
//
//
//
//        H5Fclose(fields_file_id);
//
//        if (config->debugLevel > 1) log_info << "end writing face data ";
//    }
//
//    config->pmpi->barrier();
//    
//}
//
//void IO::writeBoundaryFieldsHdf5ToOneFile2d()
//{
//    if (config->pmpi->is_master())
//    {
//        std::string timeString = config->sim_time->get_time_string_io();
//
//        EasyMesh::ParallelMesh* localMesh = static_cast<EasyMesh::ParallelMesh*>(config->mesh);
//        EasyMesh::Mesh* globalMesh = localMesh->serialMesh;
//
//        std::string hdf5FileName = "result/boundaryField_" + timeString + ".h5";
//
//        //create boundary mesh
//        if (config->debugLevel > 1) log_info << "write boundary fields: create boundary mesh begin";
//        std::vector<double> boundaryMeshPointList;
//        std::vector<int> boundaryMeshLineList;
//        std::map<int, int> globalToLocalPointMap;
//
//        int iPointLocal = 0;
//        for (auto iter = globalMesh->lineGroupMap.begin(); iter != globalMesh->lineGroupMap.end(); iter++)
//        {
//            auto lineGroupName = iter->first;
//            auto& lineGroup = iter->second;
//            if (config->debugLevel > 1) log_info << "lineGroup name: " << lineGroupName;
//
//            for (int i = 0; i < lineGroup.lineList.size(); i++)
//            {
//                int iLine = lineGroup.lineList[i];
//                EasyMesh::Line& line = globalMesh->lineList[iLine];
//                //log_info << "========= iLine " << globalMesh->lineList.size() << " " << iLine;
//                for (int iPoint = 0; iPoint < 2; iPoint++)
//                {
//                    int iPointGlobal = line.pointList[iPoint];
//                    //log_info << "------------- iPointGlobal " << globalMesh->pointList.size() << " " << iPointGlobal;
//                    auto iter = globalToLocalPointMap.find(iPointGlobal);
//                    if (iter == globalToLocalPointMap.end())
//                    {
//                        globalToLocalPointMap[iPointGlobal] = iPointLocal;
//                        boundaryMeshPointList.push_back(globalMesh->pointList[iPointGlobal].position[0]);
//                        boundaryMeshPointList.push_back(globalMesh->pointList[iPointGlobal].position[1]);
//                        boundaryMeshPointList.push_back(globalMesh->pointList[iPointGlobal].position[2]);
//                        iPointLocal++;
//                    }
//
//                    boundaryMeshLineList.push_back(globalToLocalPointMap[iPointGlobal]);
//                }
//            }
//        }
//        //log_info << "----------- line number: " << boundaryMeshLineList.size() / 3;
//        if (config->debugLevel > 1) log_info << "write boundary fields: create boundary mesh end";
//
//
//        hid_t fields_file_id = H5Fcreate(hdf5FileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//        //write boundary mesh
//        //========================== write mesh: begin =======================================================================
//        if (config->debugLevel > 1) log_info << "write boundary fields: write mesh begin";
//        hid_t domain_datagroup_id = H5Gcreate(fields_file_id, "domain", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        ////write vsType attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 4);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(domain_datagroup_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "mesh");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsKind attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 12);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsKind", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "unstructured");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vsPoints attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 8);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsPoints", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "vertices");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write time attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 5);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(domain_datagroup_id, "vsLines", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "lines");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write vertices
//
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = boundaryMeshPointList.size() / 3;
//        dims[1] = 3;
//
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        hid_t dataset_id = H5Dcreate2(domain_datagroup_id, "vertices", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryMeshPointList.data());
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        //write line
//
//        n_dim = 2;
//        dims[0] = boundaryMeshLineList.size() / 2;
//        dims[1] = 2;
//
//        dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        dataset_id = H5Dcreate2(domain_datagroup_id, "lines", H5T_NATIVE_INT, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryMeshLineList.data());
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(domain_datagroup_id);
//        if (config->debugLevel > 1) log_info << "write boundary fields: write mesh end";
//        //========================== write mesh: end =======================================================================
//
//
//        //write boundary global scalar data
//        if (config->debugLevel > 1)
//        {
//            if (config->debugLevel > 1) log_info << "write boundary fields: write one step field begin";
//            for (int iBoundaryField = 0; iBoundaryField < boundaryFields.size(); iBoundaryField++)
//            {
//                //write data
//                std::vector<double> boundaryData;
//                for (auto iter = globalMesh->lineGroupMap.begin(); iter != globalMesh->lineGroupMap.end(); iter++)
//                {
//                    auto lineGroupName = iter->first;
//
//                    if (lineGroupName == "parallelLine")
//                    {
//                        continue;
//                    }
//
//                    if (lineGroupName == "")
//                    {
//                        //临时跳过这个问题，后续要检查在哪里增加了空的lineGroup
//                        log_error << "no lineGroupName";
//                        continue;
//                    }
//                    //if (config->debugLevel > 1) log_info << lineGroupName << " begin";
//
//                    auto& boundaryField = boundaryFields[iBoundaryField]->boundaryFieldMap.find(lineGroupName)->second;
//                    for (int iLine = 0; iLine < boundaryField.globalSize(); iLine++)
//                    {
//                        boundaryData.push_back(boundaryField.data_global[iLine]);
//                    }
//                    //if (config->debugLevel > 1) log_info << lineGroupName << " end";
//
//                }
//                //log_info << "--------------- boundary data size: " << boundaryData.size();
//
//
//                int n_dim = 1;
//                hsize_t dims[1];
//                dims[0] = boundaryMeshLineList.size() / 2;
//                hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//                hid_t dataset_id = H5Dcreate2(fields_file_id, (boundaryFields[iBoundaryField]->name + "_OneStep").c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryData.data());
//                H5Sclose(dataspace_id);
//
//
//
//                //write attribute
//                ////write vsType attributes: string(char) type
//                hid_t aid = H5Screate(H5S_SCALAR);
//                hid_t atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 8);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "variable");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsKind attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 6);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "domain");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                //write vsPoints attributes: string(char) type
//                aid = H5Screate(H5S_SCALAR);
//                atype = H5Tcopy(H5T_C_S1);
//                H5Tset_size(atype, 5);
//                H5Tset_strpad(atype, H5T_STR_NULLTERM);
//                attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//                H5Awrite(attr, atype, "zonal");
//                H5Sclose(aid);
//                H5Tclose(atype);
//                H5Aclose(attr);
//
//                H5Dclose(dataset_id);
//            }
//            if (config->debugLevel > 1) log_info << "write boundary fields: write one step field end";
//        }
//
//
//        //write boundary average global scalar data
//        if (config->debugLevel > 1) log_info << "write boundary fields: write average field begin";
//        for (int iBoundaryField = 0; iBoundaryField < boundaryFields.size(); iBoundaryField++)
//        {
//            //write data
//            std::vector<double> boundaryData;
//            for (auto iter = globalMesh->lineGroupMap.begin(); iter != globalMesh->lineGroupMap.end(); iter++)
//            {
//                auto lineGroupName = iter->first;
//
//                if (lineGroupName == "parallelLine")
//                {
//                    continue;
//                }
//
//                if (lineGroupName == "")
//                {
//                    //临时跳过这个问题，后续要检查在哪里增加了空的lineGroup
//                    log_error << "no lineGroupName";
//                    continue;
//                }
//                //if (config->debugLevel > 1) log_info << lineGroupName << " begin";
//
//                auto& boundaryField = boundaryFields[iBoundaryField]->boundaryFieldMap.find(lineGroupName)->second;
//                for (int iLine = 0; iLine < boundaryField.globalSize(); iLine++)
//                {
//                    boundaryData.push_back(boundaryField.data_average_global[iLine]);
//                }
//                //if (config->debugLevel > 1) log_info << lineGroupName << " end";
//
//            }
//
//
//            int n_dim = 1;
//            hsize_t dims[1];
//            dims[0] = boundaryMeshLineList.size() / 2;
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//            hid_t dataset_id = H5Dcreate2(fields_file_id, (boundaryFields[iBoundaryField]->name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, boundaryData.data());
//            H5Sclose(dataspace_id);
//
//
//
//            //write attribute
//            ////write vsType attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 8);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variable");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsKind attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 6);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsMesh", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "domain");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write vsPoints attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsCentering", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "zonal");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            H5Dclose(dataset_id);
//        }
//        if (config->debugLevel > 1) log_info << "write boundary fields: write average field end";
//
//
//        //========================= write field boundary condition: begin =======================================================
//        hid_t fbc_datagroup_id = H5Gcreate(fields_file_id, "fiedlBoundaryCondition", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        for (auto iter = globalMesh->lineGroupMap.begin(); iter != globalMesh->lineGroupMap.end(); iter++)
//        {
//            auto lineGroupName = iter->first;
//
//            hid_t fbcEach_datagroup_id = H5Gcreate(fbc_datagroup_id, lineGroupName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//            auto fbcIter = config->emField->electric_potential->fbc_param.find(lineGroupName);
//
//            //write accumlatedCharge
//            n_dim = 1;
//            hsize_t dims1d[1];
//            dims1d[0] = 1;
//
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            hid_t dataset_id = H5Dcreate2(fbcEach_datagroup_id, "accumlatedCharge", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->accumlatedCharge));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCharge
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCharge", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCharge));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCurrent
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCurrent", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrent));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCurrentAverage
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCurrentAverage", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrentAverage));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            //write absorbedCurrentQueue
//            std::vector<double> absorbedCurrentVector;
//            while (!fbcIter->second->absorbedCurrentQueue.empty())
//            {
//                absorbedCurrentVector.push_back(fbcIter->second->absorbedCurrentQueue.front());
//                fbcIter->second->absorbedCurrentQueue.pop();
//            }
//            for (int i = 0; i < absorbedCurrentVector.size(); i++)
//            {
//                fbcIter->second->absorbedCurrentQueue.push(absorbedCurrentVector[i]);
//            }
//
//            n_dim = 1;
//            dims1d[0] = absorbedCurrentVector.size();
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "absorbedCurrentQueue", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, absorbedCurrentVector.data());
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//            //write electricForce
//            n_dim = 1;
//            dims1d[0] = 3;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "electricForce", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, fbcIter->second->electricForce);
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//            //write electricPotential
//            n_dim = 1;
//            dims1d[0] = 1;
//
//            dataspace_id = H5Screate_simple(n_dim, dims1d, NULL);
//            dataset_id = H5Dcreate2(fbcEach_datagroup_id, "electricPotential", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->fbc_value));
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//
//
//            H5Gclose(fbcEach_datagroup_id);
//
//        }
//        H5Gclose(fbc_datagroup_id);
//
//        //========================= write field boundary condition: end =======================================================
//
//
//
//
//        H5Fclose(fields_file_id);
//
//        if (config->debugLevel > 1) log_info << "end writing line data ";
//    }
//
//    config->pmpi->barrier();
//
//}
//
//void IO::writeSpeciesHdf5ToOneFile()
//{
//    config->pmpi->barrier();
//
//    std::vector<int> macroParticleNumber;
//    macroParticleNumber.resize(speciesCollection->species_list.size() * pmpi->get_size(), 0);
//    for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//    {
//        Species* species_ = speciesCollection->species_list[iSpecies];
//        for (int iRank = 0; iRank < pmpi->get_size(); iRank++)
//        {
//            if (pmpi->get_rank() == iRank)
//            {
//                macroParticleNumber[iSpecies * pmpi->get_size() + iRank] = species_->getMacroParticleNumber();
//            }
//            else
//            {
//                macroParticleNumber[iSpecies * pmpi->get_size() + iRank] = 0.0;
//            }
//        }
//    }
//    std::vector<int> macroParticleNumberTemp = macroParticleNumber;
//    pmpi->all_reduce_sum_int(macroParticleNumberTemp.data(), macroParticleNumber.data(), macroParticleNumber.size());
//
//    std::vector<int> macroParticleNumberGlobal;
//    macroParticleNumberGlobal.resize(speciesCollection->species_list.size());
//    for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//    {
//        Species* species_ = speciesCollection->species_list[i_species];
//        macroParticleNumberGlobal[i_species] = species_->getGlobalMacroParticleNumber();
//    }
//
//
//
//
//
//    //======================== write species to one hdf5 file ====================================
//    // 
//    //log_info << "begin writing species hdf5 file";
//
//    step_output_string = config->sim_time->get_time_string_io();
//
//    data_file_name = "result/species_" + step_output_string + ".h5";
//
//
//    //first: create hdf5 file, all data are set to zero
//    pmpi->barrier();
//    if (pmpi->is_master())
//    {
//        hid_t particle_file_id = H5Fcreate(data_file_name.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//        for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//        {
//            Species* species_ = speciesCollection->species_list[i_species];
//            if (config->debugLevel > 1) log_info << "writing species: " << species_->species_param.species_name;
//
//            int particle_number = macroParticleNumberGlobal[i_species];
//            if (config->debugLevel > 1) log_info << "particle_number: " << particle_number;
//
//            //if (species_->species_param.species_type == "fluid" || particle_number == 0)
//            if (species_->species_param.species_type == "fluid" || !(species_->species_param.isWrite))
//            {
//                continue;
//            }
//
//
//
//            //write all data: position, velocity, weight, iVolume, id
//            double* allData = new double[9 * particle_number];
//
//            int n_dim = 2;
//            hsize_t dims[2];
//            dims[0] = particle_number;
//            dims[1] = 9;
//
//            hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//            hid_t dataset_id = H5Dcreate2(particle_file_id, ("/" + species_->species_param.species_name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//            ////write attributes: string(char) type
//            hid_t aid = H5Screate(H5S_SCALAR);
//            hid_t atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 16);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "variableWithMesh");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write attributes: string(char) type
//            std::string vsLabels;
//            vsLabels += species_->species_param.species_name + "_x,";
//            vsLabels += species_->species_param.species_name + "_y,";
//            vsLabels += species_->species_param.species_name + "_z,";
//            vsLabels += species_->species_param.species_name + "_vx,";
//            vsLabels += species_->species_param.species_name + "_vy,";
//            vsLabels += species_->species_param.species_name + "_vz,";
//            vsLabels += species_->species_param.species_name + "_weight,";
//            vsLabels += species_->species_param.species_name + "_iVolume,";
//            vsLabels += species_->species_param.species_name + "_id";
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 100);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsLabels", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, vsLabels.c_str());
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//
//            //write attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 5);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsAxisLabels", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "x,y,z");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write time attributes: string(char) type
//            aid = H5Screate(H5S_SCALAR);
//            atype = H5Tcopy(H5T_C_S1);
//            H5Tset_size(atype, 4);
//            H5Tset_strpad(atype, H5T_STR_NULLTERM);
//            attr = H5Acreate2(dataset_id, "vsTimeGroup", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, atype, "time");
//            H5Sclose(aid);
//            H5Tclose(atype);
//            H5Aclose(attr);
//
//            //write attributes: int type
//            n_dim = 3;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "vsNumSpatialDims", H5T_NATIVE_INT, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_INT, &n_dim);
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//            n_dim = 3;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "numSpatialDims", H5T_NATIVE_INT, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_INT, &n_dim);
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//            //write mass attributes: double type
//            n_dim = 3;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "mass", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_DOUBLE, &(species_->species_param.mass));
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//            //write charge attributes: double type
//            n_dim = 3;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "charge", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_DOUBLE, &(species_->species_param.charge));
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//            //write time attributes: double type
//            double time = 1.0;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "time", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_DOUBLE, &time);
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//
//            //write numPtclsInMacro attributes: double type
//            double numPtclsInMacro = 1.0;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "numPtclsInMacro", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_DOUBLE, &numPtclsInMacro);
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//            //write attributes: int type
//            int ptclEnds = particle_number;
//            aid = H5Screate(H5S_SCALAR);
//            attr = H5Acreate2(dataset_id, "macroParticleNumber", H5T_NATIVE_INT, aid, H5P_DEFAULT, H5P_DEFAULT);
//            H5Awrite(attr, H5T_NATIVE_INT, &ptclEnds);
//            H5Sclose(aid);
//            H5Aclose(attr);
//
//
//
//
//            H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, allData);
//            H5Sclose(dataspace_id);
//            H5Dclose(dataset_id);
//            delete[] allData;
//
//
//            if (config->debugLevel > 1) log_info << "done writing species: " << species_->species_param.species_name;
//        }
//
//        H5Fclose(particle_file_id);
//
//    }
//    pmpi->barrier();
//
//
//
//
//    //every rank: open hdf5 file first, and write its own data, a part of global data
//    std::vector<int> offsetRank(speciesCollection->species_list.size(), 0);
//    for (int iRank = 0; iRank < pmpi->get_size(); iRank++)
//    {
//        pmpi->barrier();
//
//        if (pmpi->get_rank() == iRank)
//        {
//            hid_t particle_file_id = H5Fopen(data_file_name.c_str(), H5F_ACC_RDWR | H5F_ACC_DEBUG, H5P_DEFAULT);
//            //if (config->debugLevel > 1) log_info << "======================particle_file_id: " << particle_file_id << " data_file_name: " << data_file_name;
//
//            herr_t err;
//            //=============write species============================================
//            for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//            {
//                Species* species_ = speciesCollection->species_list[i_species];
//
//                int particle_number = species_->getMacroParticleNumber();
//                if (config->debugLevel > 1) log_info << "writing species: " << species_->species_param.species_name << " iRank: " << iRank << " particle number: " << particle_number;
//
//                if (species_->species_param.species_type == "fluid" || !(species_->species_param.isWrite))
//                {
//                    continue;
//                }
//
//
//                hid_t dataset_id = H5Dopen2(particle_file_id, (species_->species_param.species_name).c_str(), H5P_DEFAULT);
//                if (config->debugLevel > 1) log_info << "dataset_id: " << dataset_id;
//                //======================================= write position ================================================
//
//                double* position = new double[3 * particle_number];
//                species_->get_all_particle_position(position);
//
//                hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                hsize_t     count[2];              /* size of the hyperslab in the file */
//                hsize_t    offset[2];
//
//                offset[0] = offsetRank[i_species];
//                offset[1] = 0;
//                count[0] = particle_number;
//                count[1] = 3;
//                if (config->debugLevel > 1) log_info << "position, offset[0]: " << offset[0] << "  offset[1]: " << offset[1];
//
//                H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                int n_dim = 2;
//                hsize_t dims[2];
//                dims[0] = particle_number;
//                dims[1] = 3;
//                hid_t memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//
//                err = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, position);
//
//                H5Sclose(dataspace_id);
//                H5Sclose(memory_dataspace_id);
//                delete[] position;
//
//                //=========================================== write velocity ===================================================
//                if (config->debugLevel > 1) log_info << "writing velocity";
//                double* velocity = new double[3 * particle_number];
//                species_->get_all_particle_velocity(velocity);
//
//                dataspace_id = H5Dget_space(dataset_id);
//
//                offset[0] = offsetRank[i_species];
//                offset[1] = 3;
//                count[0] = particle_number;
//                count[1] = 3;
//
//                H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//
//                dims[0] = particle_number;
//                dims[1] = 3;
//                memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, velocity);
//
//                H5Sclose(dataspace_id);
//                H5Sclose(memory_dataspace_id);
//                delete[] velocity;
//
//
//                //=============================================== write weight ===============================================
//                if (config->debugLevel > 1) log_info << "writing weight";
//                double* weight = new double[1 * particle_number];
//                species_->get_all_particle_weight(weight);
//
//                dataspace_id = H5Dget_space(dataset_id);
//
//                offset[0] = offsetRank[i_species];
//                offset[1] = 6;
//                count[0] = particle_number;
//                count[1] = 1;
//
//                H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                dims[0] = particle_number;
//                dims[1] = 1;
//                memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, weight);
//
//                H5Sclose(dataspace_id);
//                H5Sclose(memory_dataspace_id);
//                delete[] weight;
//
//                //=================================================== write id ========================================
//                //int转换成double进行存储，读取也要转换一下
//                if (config->debugLevel > 1) log_info << "writing id";
//                double* id = new double[1 * particle_number];
//                species_->get_all_particle_id(id);
//
//                dataspace_id = H5Dget_space(dataset_id);
//
//                offset[0] = offsetRank[i_species];
//                offset[1] = 7;
//                count[0] = particle_number;
//                count[1] = 1;
//
//                H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                dims[0] = particle_number;
//                dims[1] = 1;
//                memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, id);
//
//                H5Sclose(dataspace_id);
//                H5Sclose(memory_dataspace_id);
//                delete[] id;
//
//                //============================================= write iVolume Global ============================================
//                // int转换成double进行存储，读取也要转换一下
//                if (config->debugLevel > 1) log_info << "writing iVolume";
//                double* iVolume = new double[1 * particle_number];
//                species_->get_all_particle_iVolume(iVolume);
//
//                dataspace_id = H5Dget_space(dataset_id);
//
//                offset[0] = offsetRank[i_species];
//                offset[1] = 8;
//                count[0] = particle_number;
//                count[1] = 1;
//
//                H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                dims[0] = particle_number;
//                dims[1] = 1;
//                memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, iVolume);
//
//                H5Sclose(dataspace_id);
//                H5Sclose(memory_dataspace_id);
//                delete[] iVolume;
//
//
//
//                err = H5Dclose(dataset_id);
//
//                if (config->debugLevel > 1) log_info << "done writing species: " << species_->species_param.species_name;
//            }
//
//            err = H5Fclose(particle_file_id);
//        }
//
//        for (int i = 0; i < offsetRank.size(); i++)
//        {
//            offsetRank[i] += macroParticleNumber[i*pmpi->get_size()+iRank];
//        }
//
//        pmpi->barrier();
//     }
//
//        
//}
//
//void IO::writeSpeciesHdf5AllProcess()
//{
//    //======================== write species to one hdf5 file ====================================
//    // 
//    //log_info << "begin writing species hdf5 file";
//
//    step_output_string = config->sim_time->get_time_string_io();
//
//    data_file_name = "result/speciesProc" + std::to_string(config->pmpi->get_rank()) + "_" + step_output_string + ".h5";
//
//
//    //first: create hdf5 file, all data are set to zero
//
//
//    hid_t particle_file_id = H5Fcreate(data_file_name.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//
//    for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//    {
//        Species* species_ = speciesCollection->species_list[i_species];
//        if (config->debugLevel > 1) log_info << "writing species: " << species_->species_param.species_name;
//
//        int particle_number = species_->getMacroParticleNumber();
//        if (config->debugLevel > 1) log_info << "particle_number: " << particle_number;
//
//        //if (species_->species_param.species_type == "fluid" || particle_number == 0)
//        if (species_->species_param.species_type == "fluid" || !(species_->species_param.isWrite))
//        {
//            continue;
//        }
//
//        //write all data: position, velocity, weight, iVolume, id
//        double* allData = new double[9 * particle_number];
//
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = particle_number;
//        dims[1] = 9;
//
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        hid_t dataset_id = H5Dcreate2(particle_file_id, ("/" + species_->species_param.species_name).c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        ////write attributes: string(char) type
//        hid_t aid = H5Screate(H5S_SCALAR);
//        hid_t atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 16);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        hid_t attr = H5Acreate2(dataset_id, "vsType", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "variableWithMesh");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write attributes: string(char) type
//        std::string vsLabels;
//        vsLabels += species_->species_param.species_name + "_x,";
//        vsLabels += species_->species_param.species_name + "_y,";
//        vsLabels += species_->species_param.species_name + "_z,";
//        vsLabels += species_->species_param.species_name + "_vx,";
//        vsLabels += species_->species_param.species_name + "_vy,";
//        vsLabels += species_->species_param.species_name + "_vz,";
//        vsLabels += species_->species_param.species_name + "_weight,";
//        vsLabels += species_->species_param.species_name + "_iVolume,";
//        vsLabels += species_->species_param.species_name + "_id";
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 100);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsLabels", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, vsLabels.c_str());
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//
//        //write attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 5);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsAxisLabels", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "x,y,z");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write time attributes: string(char) type
//        aid = H5Screate(H5S_SCALAR);
//        atype = H5Tcopy(H5T_C_S1);
//        H5Tset_size(atype, 4);
//        H5Tset_strpad(atype, H5T_STR_NULLTERM);
//        attr = H5Acreate2(dataset_id, "vsTimeGroup", atype, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, atype, "time");
//        H5Sclose(aid);
//        H5Tclose(atype);
//        H5Aclose(attr);
//
//        //write attributes: int type
//        n_dim = 3;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "vsNumSpatialDims", H5T_NATIVE_INT, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_INT, &n_dim);
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//        n_dim = 3;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "numSpatialDims", H5T_NATIVE_INT, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_INT, &n_dim);
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//        //write mass attributes: double type
//        n_dim = 3;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "mass", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_DOUBLE, &(species_->species_param.mass));
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//        //write charge attributes: double type
//        n_dim = 3;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "charge", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_DOUBLE, &(species_->species_param.charge));
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//        //write time attributes: double type
//        double time = 1.0;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "time", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_DOUBLE, &time);
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//
//        //write numPtclsInMacro attributes: double type
//        double numPtclsInMacro = 1.0;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "numPtclsInMacro", H5T_NATIVE_DOUBLE, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_DOUBLE, &numPtclsInMacro);
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//        //write attributes: int type
//        int ptclEnds = particle_number;
//        aid = H5Screate(H5S_SCALAR);
//        attr = H5Acreate2(dataset_id, "macroParticleNumber", H5T_NATIVE_INT, aid, H5P_DEFAULT, H5P_DEFAULT);
//        H5Awrite(attr, H5T_NATIVE_INT, &ptclEnds);
//        H5Sclose(aid);
//        H5Aclose(attr);
//
//
//
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, allData);
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//        delete[] allData;
//
//
//        if (config->debugLevel > 1) log_info << "done writing species: " << species_->species_param.species_name;
//    }
//
//    H5Fclose(particle_file_id);
//
//
//    //every rank: open hdf5 file first, and write its own data, a part of global data
//    particle_file_id = H5Fopen(data_file_name.c_str(), H5F_ACC_RDWR | H5F_ACC_DEBUG, H5P_DEFAULT);
//    //if (config->debugLevel > 1) log_info << "======================particle_file_id: " << particle_file_id << " data_file_name: " << data_file_name;
//
//    herr_t err;
//    //=============write species============================================
//    for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//    {
//        Species* species_ = speciesCollection->species_list[i_species];
//
//        int particle_number = species_->getMacroParticleNumber();
//        int iRank = config->pmpi->get_rank();
//        if (config->debugLevel > 1) log_info << "writing species: " << species_->species_param.species_name << " iRank: " << iRank << " particle number: " << particle_number;
//
//        if (species_->species_param.species_type == "fluid" || !(species_->species_param.isWrite))
//        {
//            continue;
//        }
//
//
//        hid_t dataset_id = H5Dopen2(particle_file_id, (species_->species_param.species_name).c_str(), H5P_DEFAULT);
//        if (config->debugLevel > 1) log_info << "dataset_id: " << dataset_id;
//        //======================================= write position ================================================
//
//        double* position = new double[3 * particle_number];
//        species_->get_all_particle_position(position);
//
//        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//        hsize_t     count[2];              /* size of the hyperslab in the file */
//        hsize_t    offset[2];
//
//        offset[0] = 0;
//        offset[1] = 0;
//        count[0] = particle_number;
//        count[1] = 3;
//        if (config->debugLevel > 1) log_info << "position, offset[0]: " << offset[0] << "  offset[1]: " << offset[1];
//
//        H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//        int n_dim = 2;
//        hsize_t dims[2];
//        dims[0] = particle_number;
//        dims[1] = 3;
//        hid_t memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//
//        err = H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, position);
//
//        H5Sclose(dataspace_id);
//        H5Sclose(memory_dataspace_id);
//        delete[] position;
//
//        //=========================================== write velocity ===================================================
//        if (config->debugLevel > 1) log_info << "writing velocity";
//        double* velocity = new double[3 * particle_number];
//        species_->get_all_particle_velocity(velocity);
//
//        dataspace_id = H5Dget_space(dataset_id);
//
//        offset[0] = 0;
//        offset[1] = 3;
//        count[0] = particle_number;
//        count[1] = 3;
//
//        H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//
//        dims[0] = particle_number;
//        dims[1] = 3;
//        memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, velocity);
//
//        H5Sclose(dataspace_id);
//        H5Sclose(memory_dataspace_id);
//        delete[] velocity;
//
//
//        //=============================================== write weight ===============================================
//        if (config->debugLevel > 1) log_info << "writing weight";
//        double* weight = new double[1 * particle_number];
//        species_->get_all_particle_weight(weight);
//
//        dataspace_id = H5Dget_space(dataset_id);
//
//        offset[0] = 0;
//        offset[1] = 6;
//        count[0] = particle_number;
//        count[1] = 1;
//
//        H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//        dims[0] = particle_number;
//        dims[1] = 1;
//        memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, weight);
//
//        H5Sclose(dataspace_id);
//        H5Sclose(memory_dataspace_id);
//        delete[] weight;
//
//        //=================================================== write id ========================================
//        //int转换成double进行存储，读取也要转换一下
//        if (config->debugLevel > 1) log_info << "writing id";
//        double* id = new double[1 * particle_number];
//        species_->get_all_particle_id(id);
//
//        dataspace_id = H5Dget_space(dataset_id);
//
//        offset[0] = 0;
//        offset[1] = 7;
//        count[0] = particle_number;
//        count[1] = 1;
//
//        H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//        dims[0] = particle_number;
//        dims[1] = 1;
//        memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, id);
//
//        H5Sclose(dataspace_id);
//        H5Sclose(memory_dataspace_id);
//        delete[] id;
//
//        //============================================= write iVolume ============================================
//        // int转换成double进行存储，读取也要转换一下
//        if (config->debugLevel > 1) log_info << "writing iVolume";
//        double* iVolume = new double[1 * particle_number];
//        species_->get_all_particle_iVolume(iVolume);
//
//        dataspace_id = H5Dget_space(dataset_id);
//
//        offset[0] = 0;
//        offset[1] = 8;
//        count[0] = particle_number;
//        count[1] = 1;
//
//        H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//        dims[0] = particle_number;
//        dims[1] = 1;
//        memory_dataspace_id = H5Screate_simple(n_dim, dims, NULL);
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, memory_dataspace_id, dataspace_id, H5P_DEFAULT, iVolume);
//
//        H5Sclose(dataspace_id);
//        H5Sclose(memory_dataspace_id);
//        delete[] iVolume;
//
//
//
//        err = H5Dclose(dataset_id);
//
//        if (config->debugLevel > 1) log_info << "done writing species: " << species_->species_param.species_name;
//    }
//
//    err = H5Fclose(particle_file_id);
//
//    pmpi->barrier();
//
//}
//
//
//void IO::cal_global()
//{
//    if(!config->sim_time->is_time_io())
//    {
//        return;
//    }
//
//    for(int i = 0; i < fields.size(); i++)
//    {
//        if(fields[i]->is_cal_global)
//        {
//            fields[i]->cal_global_field();
//            //log_info<<"[IO.cpp] "<<fields[i]->name;
//        }        
//    }
//
//    if (config->debugLevel > 1) log_info << "vector_fields cal_global_field " << vector_fields.size();
//    for (int i = 0; i < vector_fields.size(); i++)
//    {
//        vector_fields[i]->cal_global_field();
//    }
//
//
//    if (config->debugLevel > 1) log_info << "begin: boundaryFields cal_global_field " << boundaryFields.size();
//    for(int i = 0; i < boundaryFields.size(); i++)
//    {
//        auto& boundaryFieldName = boundaryFields[i]->name;
//        if (boundaryFieldName == "heatFlux" || boundaryFieldName == "boundaryId")
//        {
//            continue;
//        }
//
//        boundaryFields[i]->cal_global_field();
//    }
//    //calculate total heat flux
//    if (config->sim_time->is_time_io())
//    {
//        for (auto iter = speciesCollection->heatFlux->boundaryFieldMap.begin(); iter != speciesCollection->heatFlux->boundaryFieldMap.end(); iter++)
//        {
//            auto& boundaryField = iter->second;
//
//            for (int i = 0; i < boundaryField.globalSize(); i++)
//            {
//                boundaryField.data_global[i] = 0.0;
//                boundaryField.data_average_global[i] = 0.0;
//            }
//        }
//
//        for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//        {
//            auto heatFlux_species = speciesCollection->species_list[i_species]->heatFlux;
//            for (auto iter = speciesCollection->heatFlux->boundaryFieldMap.begin(); iter != speciesCollection->heatFlux->boundaryFieldMap.end(); iter++)
//            {
//                auto& boundaryFieldName = iter->first;
//                auto& boundaryField = iter->second;
//
//                auto& boundaryField_species = heatFlux_species->boundaryFieldMap.find(boundaryFieldName)->second;
//                for (int i = 0; i < boundaryField.globalSize(); i++)
//                {
//                    boundaryField.data_global[i] += boundaryField_species.data_global[i];
//                    boundaryField.data_average_global[i] += boundaryField_species.data_average_global[i];
//                }
//            }
//        }
//    }
//    if (config->debugLevel > 1) log_info << "end: boundaryFields cal_global_field ";
//}
//
//void IO::calAverage()
//{
//
//    for (int i = 0; i < fields.size(); i++)
//    {
//        fields[i]->cal_average_field();
//    }
//
//    for (int i = 0; i < vector_fields.size(); i++)
//    {
//        vector_fields[i]->cal_average_field();
//    }
//
//
//    for (int i = 0; i < boundaryFields.size(); i++)
//    {
//        //log_info << boundaryFields.size() << " " << i;
//        boundaryFields[i]->cal_average_field();
//    }
//}
//
//void IO::writeVtkMesh()
//{
//    if (config->isWriteVtk && config->isWriteAllProcess)
//    {
//        //VtkWriter* vtkWriter = new VtkWriter(config, this);
//        //vtkWriter->writeVtuMesh();
//        //vtkWriter->writeVtpMesh();
//    }
//}
//
//
//void IO::reloadSpecies()
//{
//    if(step_output_string == "")
//    {
//        return;
//    }
//    if (config->debugLevel > 1) log_info <<"----------------";
//    if (config->debugLevel > 1) log_info <<"begin reading species hdf5 file";
//
//
//    data_file_name = "result/species_" + step_output_string + ".h5";
//
//
//    hid_t particle_file_id = H5Fopen( data_file_name.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
//
//    //=============read species============================================
//    for(int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
//    {
//        Species* species_ = speciesCollection->species_list[i_species];
//        if (config->debugLevel > 1) log_info << "---------------reading species: " << species_->species_param.species_name;
//
//        if (species_->species_param.species_type == "fluid")
//        {
//            continue;
//        }
//
//        hid_t dataset_id = H5Dopen(particle_file_id, species_->species_param.species_name.c_str(), H5P_DEFAULT);
//
//        //read macroParticleNumberGlobal;
//        int macroParticleNumberGlobal;
//        hid_t attr = H5Aopen(dataset_id, "macroParticleNumber", H5P_DEFAULT);
//        hid_t ret = H5Aread(attr, H5T_NATIVE_INT, &macroParticleNumberGlobal);
//        H5Aclose(attr);
//
//        if (config->debugLevel > 1) log_info << "---------------macroParticleNumberGlobal: " << macroParticleNumberGlobal;
//
//        //read all data
//        double* allData = new double[macroParticleNumberGlobal * 9];
//
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, allData);
//        H5Dclose(dataset_id);
//
//
//
//        for(int iParticle = 0; iParticle < macroParticleNumberGlobal; iParticle++)
//        {
//            int iVolumeGlobal = allData[iParticle * 9 + 8];
//            int iVolume = -1;
//
//            if (config->dimension == 3)
//            {
//                iVolume = config->mesh->localVolumeIndices[iVolumeGlobal];
//            }
//            else if (config->dimension == 2)
//            {
//                iVolume = config->mesh->localFaceIndices[iVolumeGlobal];
//            }
//
//            if (iVolume >= 0)
//            {
//                auto& cellParticle = species_->particles[iVolume];
//                Particle<3> particle;
//                particle.position[0]            = allData[iParticle * 9 + 0];
//                particle.position[1]            = allData[iParticle * 9 + 1];
//                particle.position[2]            = allData[iParticle * 9 + 2];
//                particle.velocity[0]            = allData[iParticle * 9 + 3];
//                particle.velocity[1]            = allData[iParticle * 9 + 4];
//                particle.velocity[2]            = allData[iParticle * 9 + 5];
//                particle.weight                 = allData[iParticle * 9 + 6];
//                particle.id                     = allData[iParticle * 9 + 7];
//                particle.globalVolumeIndex      = allData[iParticle * 9 + 8];
//                particle.iVolume                = iVolume;
//
//                if (config->dimension == 3)
//                {
//                    species_->calBarycentricCoordinateOfParticle(particle);
//                }
//                else if (config->dimension == 2)
//                {
//                    species_->calBarycentricCoordinateOfParticle2d(particle);
//                }
//                
//
//
//                cellParticle.add_new_particle(particle);
//
//
//            }
//        }
//        
//        delete[] allData;
//        H5Dclose(dataset_id);
//        //log_info << "done reading species: " << species_->species_param.species_name;
//    }
//    
//    H5Fclose(particle_file_id);
//
//    log_info << "end reading species hdf5 file";
//}
//
//
//void IO::reloadFields()
//{
//    if (step_output_string == "")
//    {
//        return;
//    }
//    if (config->debugLevel > 1) log_info << "----------------";
//    if (config->debugLevel > 1) log_info << "reading fields hdf5 file: begin";
//
//    std::string fieldsFileName = "result/fields_" + step_output_string + ".h5";
//
//    hid_t fields_file_id = H5Fopen(fieldsFileName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
//    //log_info << "fields_file_id: " << fields_file_id;
//
//    EasyMesh::ParallelMesh* localMesh = config->mesh;
//
//    double* dataGlobal = new double[localMesh->numberPointSerial];
//
//    //read electric_potential
//    if (config->debugLevel > 1) log_info << "reading electric_potential: begin";
//    hid_t dataset_id = H5Dopen(fields_file_id, "electric_potential", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dataGlobal);
//    H5Dclose(dataset_id);
//
//    Field<double>* scalarField = config->emField->electric_potential;
//    for (int iPointGlobal = 0; iPointGlobal < localMesh->numberPointSerial; iPointGlobal++)
//    {
//        int iPointLocal = localMesh->localPointIndices[iPointGlobal];
//        //log_info << "iPoint " << localMesh->numberPointSerial << " " << iPointGlobal << " " << iPointLocal;
//        if (iPointLocal > -1)
//        {
//            (*scalarField)(iPointLocal) = dataGlobal[iPointGlobal];
//        }
//    }
//    if (config->debugLevel > 1) log_info << "reading electric_potential: end";
//    
//    //read depositChargeDensity
//    dataset_id = H5Dopen(fields_file_id, "depositChargeDensity", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dataGlobal);
//    H5Dclose(dataset_id);
//
//    scalarField = config->emField->depositChargeDensity;
//    for (int iPointGlobal = 0; iPointGlobal < localMesh->numberPointSerial; iPointGlobal++)
//    {
//        int iPointLocal = localMesh->localPointIndices[iPointGlobal];
//        if (iPointLocal > -1)
//        {
//            (*scalarField)(iPointLocal) = dataGlobal[iPointGlobal];
//        }
//    }
//
//    delete[] dataGlobal;
//
//
//    dataGlobal = new double[localMesh->numberPointSerial * 3];
//
//    //read electric_field
//    dataset_id = H5Dopen(fields_file_id, "electric_field", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dataGlobal);
//    H5Dclose(dataset_id);
//
//    Field<FemVector3D>* vectorField = config->emField->electric_field;
//    for (int iPointGlobal = 0; iPointGlobal < localMesh->numberPointSerial; iPointGlobal++)
//    {
//        int iPointLocal = localMesh->localPointIndices[iPointGlobal];
//        if (iPointLocal > -1)
//        {
//            (*vectorField)(iPointLocal).x[0] = dataGlobal[iPointGlobal * 3 + 0];
//            (*vectorField)(iPointLocal).x[1] = dataGlobal[iPointGlobal * 3 + 1];
//            (*vectorField)(iPointLocal).x[2] = dataGlobal[iPointGlobal * 3 + 2];
//        }
//    }
//
//    //read magneticField
//    dataset_id = H5Dopen(fields_file_id, "magneticField", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dataGlobal);
//    H5Dclose(dataset_id);
//
//    vectorField = config->emField->magneticField;
//    for (int iPointGlobal = 0; iPointGlobal < localMesh->numberPointSerial; iPointGlobal++)
//    {
//        int iPointLocal = localMesh->localPointIndices[iPointGlobal];
//        if (iPointLocal > -1)
//        {
//            (*vectorField)(iPointLocal).x[0] = dataGlobal[iPointGlobal * 3 + 0];
//            (*vectorField)(iPointLocal).x[1] = dataGlobal[iPointGlobal * 3 + 1];
//            (*vectorField)(iPointLocal).x[2] = dataGlobal[iPointGlobal * 3 + 2];
//        }
//    }
//
//    delete[] dataGlobal;
//
//
//    //=======================reload emFieldParameters: begin=============================================================
//    hid_t datagroup_id = H5Gopen(fields_file_id, "EMfieldParameters", H5P_DEFAULT);
//
//    //read accumlatedCharge
//    dataset_id = H5Dopen(datagroup_id, "accumlatedCharge", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->emField->accumlatedCharge));
//    H5Dclose(dataset_id);
//
//    //read accumlatedChargeInAccelerateStep0
//    dataset_id = H5Dopen(datagroup_id, "accumlatedChargeInAccelerateStep0", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->emField->accumlatedChargeInAccelerateStep0));
//    H5Dclose(dataset_id);
//
//    //read accumlatedChargeInAccelerateStep1
//    dataset_id = H5Dopen(datagroup_id, "accumlatedChargeInAccelerateStep1", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->emField->accumlatedChargeInAccelerateStep1));
//    H5Dclose(dataset_id);
//
//    //read accelerateFactorK
//    dataset_id = H5Dopen(datagroup_id, "accelerateFactorK", H5P_DEFAULT);
//    H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(config->emField->accelerateFactorK));
//
//    H5Dclose(dataset_id);
//    H5Gclose(datagroup_id);
//    //=======================reload emFieldParameters: end=============================================================
//
//
//
//    H5Fclose(fields_file_id);
//
//    if (config->debugLevel > 1) log_info << "reading fields hdf5 file: end";
//}
//
//void IO::reloadFiedlBoundaryCondition3d()
//{
//    EasyMesh::ParallelMesh* localMesh = static_cast<EasyMesh::ParallelMesh*>(config->mesh);
//
//    std::string boundaryFileName = "result/boundaryField_" + step_output_string + ".h5";
//
//    hid_t boundary_file_id = H5Fopen(boundaryFileName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
//    //log_info << "read boundary conditon, boundary_file_id: " << boundary_file_id;
//
//    //========================= read field boundary condition: begin =======================================================
//    hid_t fbc_datagroup_id = H5Gopen(boundary_file_id, "fiedlBoundaryCondition", H5P_DEFAULT);
//
//
//    for (auto iter = localMesh->faceGroupMap.begin(); iter != localMesh->faceGroupMap.end(); iter++)
//    {
//        auto faceGroupName = iter->first;
//        if (faceGroupName == "parallelFace" || faceGroupName == "parallelLine")
//        {
//            continue;
//        }
//        //log_info << "boundary name: " << faceGroupName;
//
//        hid_t fbcEach_datagroup_id = H5Gopen(fbc_datagroup_id, faceGroupName.c_str(), H5P_DEFAULT);
//        auto fbcIter = config->emField->electric_potential->fbc_param.find(faceGroupName);
//
//        //read accumlatedCharge
//        hid_t dataset_id = H5Dopen(fbcEach_datagroup_id, "accumlatedCharge", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->accumlatedCharge));
//        H5Dclose(dataset_id);
//
//
//        //read absorbedCharge
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCharge", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCharge));
//        H5Dclose(dataset_id);
//
//
//        //read absorbedCurrent
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCurrent", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrent));
//        H5Dclose(dataset_id);
//
//
//        //read absorbedCurrentAverage
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCurrentAverage", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrentAverage));
//        H5Dclose(dataset_id);
//
//
//        //write absorbedCurrentQueue
//        std::vector<double> absorbedCurrentVector;
//        absorbedCurrentVector.resize(fbcIter->second->averageStep);
//
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCurrentQueue", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, absorbedCurrentVector.data());
//        H5Dclose(dataset_id);
//
//        for (int i = 0; i < absorbedCurrentVector.size(); i++)
//        {
//            fbcIter->second->absorbedCurrentQueue.push(absorbedCurrentVector[i]);
//        }
//
//        //read electricPotential
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "electricPotential", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->fbc_value));
//        H5Dclose(dataset_id);
//
//
//        H5Gclose(fbcEach_datagroup_id);
//
//    }
//    H5Gclose(fbc_datagroup_id);
//
//    H5Fclose(boundary_file_id);
//    //========================= read field boundary condition: end =======================================================
//
//
//}
//
//void IO::reloadFiedlBoundaryCondition2d()
//{
//    EasyMesh::ParallelMesh* localMesh = static_cast<EasyMesh::ParallelMesh*>(config->mesh);
//
//    std::string boundaryFileName = "result/boundaryField_" + step_output_string + ".h5";
//
//    hid_t boundary_file_id = H5Fopen(boundaryFileName.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
//    //log_info << "read boundary conditon, boundary_file_id: " << boundary_file_id;
//
//    //========================= read field boundary condition: begin =======================================================
//    hid_t fbc_datagroup_id = H5Gopen(boundary_file_id, "fiedlBoundaryCondition", H5P_DEFAULT);
//
//
//    for (auto iter = localMesh->lineGroupMap.begin(); iter != localMesh->lineGroupMap.end(); iter++)
//    {
//        auto lineGroupName = iter->first;
//        if (lineGroupName == "parallelFace" || lineGroupName == "parallelLine")
//        {
//            continue;
//        }
//        //log_info << "boundary name: " << faceGroupName;
//
//        hid_t fbcEach_datagroup_id = H5Gopen(fbc_datagroup_id, lineGroupName.c_str(), H5P_DEFAULT);
//        auto fbcIter = config->emField->electric_potential->fbc_param.find(lineGroupName);
//
//        //read accumlatedCharge
//        hid_t dataset_id = H5Dopen(fbcEach_datagroup_id, "accumlatedCharge", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->accumlatedCharge));
//        H5Dclose(dataset_id);
//
//
//        //read absorbedCharge
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCharge", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCharge));
//        H5Dclose(dataset_id);
//
//
//        //read absorbedCurrent
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCurrent", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrent));
//        H5Dclose(dataset_id);
//
//
//        //read absorbedCurrentAverage
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCurrentAverage", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->absorbedCurrentAverage));
//        H5Dclose(dataset_id);
//
//
//        //write absorbedCurrentQueue
//        std::vector<double> absorbedCurrentVector;
//        absorbedCurrentVector.resize(fbcIter->second->averageStep);
//
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "absorbedCurrentQueue", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, absorbedCurrentVector.data());
//        H5Dclose(dataset_id);
//
//        for (int i = 0; i < absorbedCurrentVector.size(); i++)
//        {
//            fbcIter->second->absorbedCurrentQueue.push(absorbedCurrentVector[i]);
//        }
//
//        //read electricPotential
//        dataset_id = H5Dopen(fbcEach_datagroup_id, "electricPotential", H5P_DEFAULT);
//        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &(fbcIter->second->fbc_value));
//        H5Dclose(dataset_id);
//
//
//        H5Gclose(fbcEach_datagroup_id);
//
//    }
//    H5Gclose(fbc_datagroup_id);
//
//    H5Fclose(boundary_file_id);
//    //========================= read field boundary condition: end =======================================================
//
//
//}
//
////以前的代码，以后可能改回来
////void IO::reloadSpecies()
////{
////    if (step_output_string == "")
////    {
////        return;
////    }
////    log_info << "----------------";
////    log_info << "begin reading species hdf5 file";
////
////
////    data_file_name = "result/species_" + step_output_string + ".h5";
////
////
////    hid_t particle_file_id = H5Fopen(data_file_name.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
////
////    //=============read species============================================
////    for (int i_species = 0; i_species < speciesCollection->species_list.size(); i_species++)
////    {
////        Species* species_ = speciesCollection->species_list[i_species];
////
////        if (species_->species_param.species_type == "fluid")
////        {
////            continue;
////        }
////
////        hid_t group_id = H5Gopen(particle_file_id, ("/" + species_->species_param.species_name).c_str(), H5P_DEFAULT);
////
////        if (config->debugLevel > 1) log_info << "---------------reading species: " << species_->species_param.species_name;
////
////        int macroParticleNumberGlobal;
////
////        //read macro particle number
////        if (config->debugLevel > 1) log_info << "---------------reading macroParticleNumber";
////        hid_t dataset_id = H5Dopen(group_id, "macroParticleNumber", H5P_DEFAULT);
////        H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &macroParticleNumberGlobal);
////        H5Dclose(dataset_id);
////        if (config->debugLevel > 1) log_info << "macroParticleNumberGlobal: " << macroParticleNumberGlobal;
////
////
////        //read iVolume
////        if (config->debugLevel > 1) log_info << "---------------reading iVolume";
////        int* iVolumeGlobal = new int[1 * macroParticleNumberGlobal];
////
////        int macroParticleNumber;
////        std::vector<int> localParticleIndex;
////        dataset_id = H5Dopen(group_id, "iVolume", H5P_DEFAULT);
////        H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, iVolumeGlobal);
////        for (int iParticle = 0; iParticle < macroParticleNumberGlobal; iParticle++)
////        {
////            int iVolume = config->mesh->localVolumeIndices[iVolumeGlobal[iParticle]];
////            if (iVolume >= 0)
////            {
////                auto& cellParticle = species_->particles[iVolume];
////                cellParticle.add_new_particle();
////
////                localParticleIndex.push_back(iParticle);
////            }
////        }
////        macroParticleNumber = localParticleIndex.size();
////        delete[] iVolumeGlobal;
////        if (config->debugLevel > 1) log_info << "macroParticleNumber: " << macroParticleNumber;
////
////        //read position
////        if (config->debugLevel > 1) log_info << "---------------reading position";
////        double* positionGlobal = new double[3 * macroParticleNumberGlobal];
////        double* position = new double[3 * macroParticleNumber];
////
////        dataset_id = H5Dopen(group_id, "position", H5P_DEFAULT);
////        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, positionGlobal);
////
////        for (int i = 0; i < macroParticleNumber; i++)
////        {
////            position[i * 3 + 0] = positionGlobal[localParticleIndex[i] * 3 + 0];
////            position[i * 3 + 1] = positionGlobal[localParticleIndex[i] * 3 + 1];
////            position[i * 3 + 2] = positionGlobal[localParticleIndex[i] * 3 + 2];
////        }
////
////        species_->set_all_particle_position(position);
////        if (config->dimension == 3)
////        {
////            species_->calBarycentricCoordinateOfAllParticle();
////        }
////        else if (config->dimension == 2)
////        {
////            species_->calBarycentricCoordinateOfAllParticle2d();
////        }
////        else
////        {
////            log_error << "not support dimension: " << config->dimension;
////            exit(0);
////        }
////
////        H5Dclose(dataset_id);
////        delete[] position;
////        delete[] positionGlobal;
////
////        //write velocity
////        if (config->debugLevel > 1) log_info << "---------------reading velocity";
////        double* velocityGlobal = new double[3 * macroParticleNumberGlobal];
////        double* velocity = new double[3 * macroParticleNumber];
////
////        dataset_id = H5Dopen(group_id, "velocity", H5P_DEFAULT);
////        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, velocityGlobal);
////
////        for (int i = 0; i < macroParticleNumber; i++)
////        {
////            velocity[i * 3 + 0] = velocityGlobal[localParticleIndex[i] * 3 + 0];
////            velocity[i * 3 + 1] = velocityGlobal[localParticleIndex[i] * 3 + 1];
////            velocity[i * 3 + 2] = velocityGlobal[localParticleIndex[i] * 3 + 2];
////        }
////
////        species_->set_all_particle_velocity(velocity);
////        H5Dclose(dataset_id);
////        delete[] velocity;
////        delete[] velocityGlobal;
////
////
////        //write weight
////        if (config->debugLevel > 1) log_info << "---------------reading weight";
////        double* weightGlobal = new double[1 * macroParticleNumberGlobal];
////        double* weight = new double[1 * macroParticleNumber];
////
////        dataset_id = H5Dopen(group_id, "weight", H5P_DEFAULT);
////        H5Dread(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, weightGlobal);
////
////        for (int i = 0; i < macroParticleNumber; i++)
////        {
////            weight[i * 1 + 0] = weightGlobal[localParticleIndex[i] * 1 + 0];
////        }
////
////        species_->set_all_particle_weight(weight);
////        H5Dclose(dataset_id);
////        delete[] weight;
////        delete[] weightGlobal;
////
////        //write id
////        if (config->debugLevel > 1) log_info << "---------------reading id";
////        int* idGlobal = new int[1 * macroParticleNumberGlobal];
////        int* id = new int[1 * macroParticleNumber];
////
////        dataset_id = H5Dopen(group_id, "id", H5P_DEFAULT);
////        H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, idGlobal);
////
////        for (int i = 0; i < macroParticleNumber; i++)
////        {
////            id[i * 1 + 0] = idGlobal[localParticleIndex[i] * 1 + 0];
////        }
////
////        species_->set_all_particle_id(id);
////        H5Dclose(dataset_id);
////        delete[] id;
////        delete[] idGlobal;
////
////        H5Gclose(group_id);
////
////        //log_info << "done reading species: " << species_->species_param.species_name;
////    }
////
////    H5Fclose(particle_file_id);
////
////    log_info << "end reading species hdf5 file";
////}
//
//void IO::writeRecord()
//{
//    if (config->sim_time->is_time_io())
//    {
//        auto recordCollection = config->recordCollection;
//        for (int iRecord = 0; iRecord < recordCollection->recordList.size(); iRecord++)
//        {
//            Record* record = recordCollection->recordList[iRecord];
//            record->reset();
//        }
//
//        recordCollection->iTimeStepRecord = 0;
//    }
//
//
//
//    if (!(config->sim_time->is_time_io()) || !pmpi->is_master())
//    {
//        return;
//    }
//
//
//    auto recordCollection = config->recordCollection;
//
//    //log_info << "begin writing record hdf5 file";
//    std::string record_file_name = "result/record.h5";
//
//    //relaod: extend the record file
//    if (config->sim_time_param.isReload == true && isFirstTime == true)
//    {
//        //open file
//        hid_t record_file_id = H5Fopen(record_file_name.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
//        if (record_file_id == -1)
//        {
//
//        }
//        else
//        {
//            //log_info << "record size: " << recordCollection->recordList.size();
//            for (int iRecord = 0; iRecord < recordCollection->recordList.size(); iRecord++)
//            {
//                Record* record = recordCollection->recordList[iRecord];
//                record->iTimeStepRecord = 0;
//
//                if (record->record_param.recordType == "particleMacroNumber")
//                {
//                    RecordParticleMacroNumber* recordCurrent = static_cast<RecordParticleMacroNumber*>(record);
//
//                    //open group
//                    hid_t group_id = H5Gopen2(record_file_id, "particleMacroNumber", H5P_DEFAULT);
//
//                    //write for each species
//                    for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//                    {
//                        std::string speciesName = speciesCollection->species_list[iSpecies]->species_param.species_name;
//
//                        hid_t dataset_id = H5Dopen2(group_id, speciesName.c_str(), H5P_DEFAULT);
//
//                        //get dataspace_id
//                        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                        //get rank: n_dim
//                        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                        if (n_dim != 1)
//                        {
//                            log_error << "n_dim: " << n_dim;
//                            //exit(0);
//                        }
//
//                        hsize_t dims[1];
//                        hsize_t dimsExtend[1];
//
//                        dimsExtend[0] = iTimePreviousOutput;
//
//                        //extend dataset
//                        H5Dextend(dataset_id, dimsExtend);
//
//                        H5Sclose(dataspace_id);
//                        H5Dclose(dataset_id);
//
//                    }
//                    H5Gclose(group_id);
//
//                }
//                else if (record->record_param.recordType == "particlePhysicalNumber")
//                {
//                    RecordParticlePhysicalNumber* recordCurrent = static_cast<RecordParticlePhysicalNumber*>(record);
//
//                    //open group
//                    hid_t group_id = H5Gopen2(record_file_id, "particlePhysicalNumber", H5P_DEFAULT);
//
//                    //write for each species
//                    for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//                    {
//                        std::string speciesName = speciesCollection->species_list[iSpecies]->species_param.species_name;
//
//                        hid_t dataset_id = H5Dopen2(group_id, speciesName.c_str(), H5P_DEFAULT);
//
//                        //get dataspace_id
//                        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                        //get rank: n_dim
//                        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                        if (n_dim != 1)
//                        {
//                            log_error << "n_dim: " << n_dim;
//                            //exit(0);
//                        }
//
//                        hsize_t dims[1];
//                        hsize_t dimsExtend[1];
//
//
//                        dimsExtend[0] = iTimePreviousOutput;
//
//                        //extend dataset
//                        H5Dextend(dataset_id, dimsExtend);
//
//                        H5Sclose(dataspace_id);
//                        H5Dclose(dataset_id);
//
//                    }
//                    H5Gclose(group_id);
//                }
//                else if (record->record_param.recordType == "fieldAtMonitorPoint")
//                {
//                    RecordFieldAtMonitorPoint* recordCurrent = static_cast<RecordFieldAtMonitorPoint*>(record);
//
//                    //open group
//                    std::string groupNameString = "fieldAtMonitorPoint-" + record->record_param.recordName;
//                    hid_t group_id = H5Gopen2(record_file_id, groupNameString.c_str(), H5P_DEFAULT);
//
//                    //write sclar field
//                    for (int iScalarField = 0; iScalarField < recordCurrent->scalarFieldData.size(); iScalarField++)
//                    {
//                        std::string scalarFieldName = recordCurrent->scalarFieldList[iScalarField]->name;
//
//                        hid_t dataset_id = H5Dopen2(group_id, scalarFieldName.c_str(), H5P_DEFAULT);
//
//                        //get dataspace_id
//                        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                        //get rank: n_dim
//                        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                        if (n_dim != 1)
//                        {
//                            log_error << "n_dim: " << n_dim;
//                            //exit(0);
//                        }
//
//                        hsize_t dims[1];
//                        hsize_t dimsExtend[1];
//
//                        dimsExtend[0] = iTimePreviousOutput;
//
//                        H5Sclose(dataspace_id);
//                        H5Dclose(dataset_id);
//                    }
//
//                    //write vector field
//                    for (int iVectorField = 0; iVectorField < recordCurrent->vectorFieldData.size(); iVectorField++)
//                    {
//                        std::string vectorFieldName = recordCurrent->vectorFieldList[iVectorField]->name;
//
//                        hid_t dataset_id = H5Dopen2(group_id, vectorFieldName.c_str(), H5P_DEFAULT);
//
//                        //get dataspace_id
//                        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                        //get rank: n_dim
//                        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                        if (n_dim != 2)
//                        {
//                            log_error << "n_dim: " << n_dim;
//                            //exit(0);
//                        }
//
//                        hsize_t dims[2];
//                        hsize_t dimsExtend[2];
//
//                        dimsExtend[0] = iTimePreviousOutput;
//                        dimsExtend[1] = dims[1];
//
//                        //extend dataset
//                        H5Dextend(dataset_id, dimsExtend);
//
//                        H5Sclose(dataspace_id);
//                        H5Dclose(dataset_id);
//                    }
//                    H5Gclose(group_id);
//                }
//                else if (record->record_param.recordType == "boundaryCurrent")
//                {
//                    RecordBoundaryCurrent* recordCurrent = static_cast<RecordBoundaryCurrent*>(record);
//
//                    //open group
//                    hid_t group_id = H5Gopen2(record_file_id, "boundaryCurrent", H5P_DEFAULT);
//
//                    //write for each boundary
//                    int ibc = 0;
//                    for (auto iter = recordCurrent->emField->electric_potential->fbc_param.begin(); iter != recordCurrent->emField->electric_potential->fbc_param.end(); iter++)
//                    {
//                        auto& boundaryName = iter->first;
//                        hid_t dataset_id = H5Dopen2(group_id, boundaryName.c_str(), H5P_DEFAULT);
//
//                        //get dataspace_id
//                        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                        //get rank: n_dim
//                        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                        if (n_dim != 1)
//                        {
//                            log_error << "n_dim: " << n_dim;
//                            //exit(0);
//                        }
//
//                        hsize_t dims[1];
//                        hsize_t dimsExtend[1];
//
//
//                        dimsExtend[0] = iTimePreviousOutput;
//
//                        //extend dataset
//                        H5Dextend(dataset_id, dimsExtend);
//
//                        H5Sclose(dataspace_id);
//                        H5Dclose(dataset_id);
//
//
//                        ibc++;
//                    }
//
//                    H5Gclose(group_id);
//                }
//                else if (record->record_param.recordType == "boundaryElectricPotential")
//                {
//                RecordBoundaryElectricPotential* recordCurrent = static_cast<RecordBoundaryElectricPotential*>(record);
//
//                //open group
//                hid_t group_id = H5Gopen2(record_file_id, "boundaryElectricPotential", H5P_DEFAULT);
//
//                //write for each boundary
//                int ibc = 0;
//                for (auto iter = recordCurrent->emField->electric_potential->fbc_param.begin(); iter != recordCurrent->emField->electric_potential->fbc_param.end(); iter++)
//                {
//                    auto& boundaryName = iter->first;
//                    hid_t dataset_id = H5Dopen2(group_id, boundaryName.c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 1)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[1];
//                    hsize_t dimsExtend[1];
//
//
//                    dimsExtend[0] = iTimePreviousOutput;
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//
//
//                    ibc++;
//                }
//
//                H5Gclose(group_id);
//                }
//                else if (record->record_param.recordType == "electricPropulsion")
//                {
//                    RecordThruster* recordThruster = static_cast<RecordThruster*>(record);
//
//                    //open group
//                    std::string groupName = record->record_param.recordType + "-" + record->record_param.faceGroupName;
//                    hid_t group_id = H5Gopen2(record_file_id, groupName.c_str(), H5P_DEFAULT);
//
//                    for (int iItem = 0; iItem < recordThruster->itemNameList.size(); iItem++)
//                    {
//                        hid_t dataset_id = H5Dopen2(group_id, recordThruster->itemNameList[iItem].c_str(), H5P_DEFAULT);
//
//                        //get dataspace_id
//                        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                        //get rank: n_dim
//                        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                        if (n_dim != 1)
//                        {
//                            log_error << "n_dim: " << n_dim;
//                            //exit(0);
//                        }
//
//                        hsize_t dims[1];
//                        hsize_t dimsExtend[1];
//
//
//                        dimsExtend[0] = iTimePreviousOutput;
//
//                        //extend dataset
//                        H5Dextend(dataset_id, dimsExtend);
//
//                        H5Sclose(dataspace_id);
//                        H5Dclose(dataset_id);
//                    }
//
//                    H5Gclose(group_id);
//                }
//
//            }
//
//            //================================write record time=======================================
//            //open group
//            hid_t group_id = H5Gopen2(record_file_id, "time", H5P_DEFAULT);
//
//            //--------------------------------write simulationTime----------------------------------------
//            hid_t dataset_id = H5Dopen2(group_id, "simulationTime", H5P_DEFAULT);
//
//
//            hsize_t dims[1];
//            hsize_t dimsExtend[1];
//
//            //������д���ݵĻ���extend�������á�
//            dimsExtend[0] = iTimePreviousOutput;
//            log_warning << "dimsExtend[0]aaa: " << dimsExtend[0];
//
//            //extend dataset
//            H5Dextend(dataset_id, dimsExtend);
//
//            H5Dclose(dataset_id);
//            H5Gclose(group_id);
//
//
//            H5Fclose(record_file_id);
//        }
//
//
//        
//    }
//
//    //not reload: delete the old record file
//    if (config->debugLevel > 0)
//    {
//        if (config->sim_time_param.isReload == false && isFirstTime == true)
//        {
//            if (ACCESS(record_file_name.c_str(), 0) == 0)
//            {
//                //��һ��д�ļ����Ҳ���reLoad������ǰ��record������
//                std::string recordFileNameOld = "result/record";
//                WallTime wallTime;
//                std::string str = wallTime.getDateTimeString();
//                recordFileNameOld += str;
//                recordFileNameOld += ".h5";
//                //remove("result/recordOld.h5");
//                //log_info << recordFileNameOld;
//                //rename(record_file_name.c_str(), recordFileNameOld.c_str());
//                remove(record_file_name.c_str());
//            }
//            isFirstTime = false;
//        }
//    }
//
//
//    hid_t record_file_id = H5Fopen(record_file_name.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
//    //log_info << "record_file_id: " << record_file_id;
//
//    //record file does not exit, create file and write first time
//    if (record_file_id == -1)
//    {
//        record_file_id = H5Fcreate(record_file_name.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
//        //log_info << "record_file_id: " << record_file_id;
//
//        //log_info << "record size: " << recordCollection->recordList.size();
//        for (int iRecord = 0; iRecord < recordCollection->recordList.size(); iRecord++)
//        {
//            Record* record = recordCollection->recordList[iRecord];
//
//            if (record->record_param.recordType == "particleMacroNumber")
//            {
//                RecordParticleMacroNumber* recordCurrent = static_cast<RecordParticleMacroNumber*>(record);
//                //create group
//                hid_t group_id = H5Gcreate(record_file_id, "particleMacroNumber", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //log_info << "particleMacroNumber group_id: " << group_id;
//                //exit(0);
//
//                //write for each species
//                for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//                {
//                    std::string speciesName = speciesCollection->species_list[iSpecies]->species_param.species_name;
//
//                    //create space
//                    int n_dim = 1;
//                    hsize_t dims[1];
//                    dims[0] = config->sim_time->timestep_io;
//                    hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//                    hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                    //log_info << "dataspace_id: " << dataspace_id;
//
//                    //Modify dataset creation properties to enable chunking
//                    //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                    hid_t cparms;
//                    hsize_t chunk_dims[1] = { 10 };
//                    cparms = H5Pcreate(H5P_DATASET_CREATE);
//                    H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                    //create dataset
//                    hid_t dataset_id = H5Dcreate(group_id, speciesName.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                    //log_info << "dataset_id: " << dataset_id;
//
//
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCurrent->data[iSpecies].data());
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//                H5Gclose(group_id);
//
//            }
//            else if (record->record_param.recordType == "particlePhysicalNumber")
//            {
//                RecordParticlePhysicalNumber* recordCurrent = static_cast<RecordParticlePhysicalNumber*>(record);
//                //create group
//                hid_t group_id = H5Gcreate(record_file_id, "particlePhysicalNumber", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //log_info << "particlePhysicalNumber group_id: " << group_id;
//                //exit(0);
//
//                //write for each species
//                for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//                {
//                    std::string speciesName = speciesCollection->species_list[iSpecies]->species_param.species_name;
//
//                    //create space
//                    int n_dim = 1;
//                    hsize_t dims[1];
//                    dims[0] = config->sim_time->timestep_io;
//                    hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//                    hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                    //log_info << "dataspace_id: " << dataspace_id;
//
//                    //Modify dataset creation properties to enable chunking
//                    //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                    hid_t cparms;
//                    hsize_t chunk_dims[1] = { 10 };
//                    cparms = H5Pcreate(H5P_DATASET_CREATE);
//                    H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                    //create dataset
//                    hid_t dataset_id = H5Dcreate(group_id, speciesName.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                    //log_info << "dataset_id: " << dataset_id;
//
//
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCurrent->data[iSpecies].data());
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//                H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "fieldAtMonitorPoint")
//            {
//                RecordFieldAtMonitorPoint* recordCurrent = static_cast<RecordFieldAtMonitorPoint*>(record);
//                //create group
//                std::string groupNameString = "fieldAtMonitorPoint-" + record->record_param.recordName;
//                hid_t group_id = H5Gcreate(record_file_id, groupNameString.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //log_info << "particlePhysicalNumber group_id: " << group_id;
//                //exit(0);
//
//                //write sclar field
//                for (int iScalarField = 0; iScalarField < recordCurrent->scalarFieldData.size(); iScalarField++)
//                {
//                    std::string scalarFieldName = recordCurrent->scalarFieldList[iScalarField]->name;
//
//                    //create space
//                    int n_dim = 1;
//                    hsize_t dims[1];
//                    dims[0] = config->sim_time->timestep_io;
//                    hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//                    hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                    //log_info << "dataspace_id: " << dataspace_id;
//
//                    //Modify dataset creation properties to enable chunking
//                    //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                    hid_t cparms;
//                    hsize_t chunk_dims[1] = { 10 };
//                    cparms = H5Pcreate(H5P_DATASET_CREATE);
//                    H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                    //create dataset
//                    hid_t dataset_id = H5Dcreate(group_id, scalarFieldName.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                    //log_info << "dataset_id: " << dataset_id;
//
//
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCurrent->scalarFieldData[iScalarField].data());
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//
//                //write vector field
//                for (int iVectorField = 0; iVectorField < recordCurrent->vectorFieldData.size(); iVectorField++)
//                {
//                    std::string vectorFieldName = recordCurrent->vectorFieldList[iVectorField]->name;
//
//                    //create space
//                    //����ʸ��������д����ά���ǣ�timestep_io x 3
//                    int n_dim = 2;
//                    hsize_t dims[2];
//                    dims[0] = config->sim_time->timestep_io;
//                    dims[1] = 3;
//                    hsize_t maxdims[2] = {H5S_UNLIMITED, 3};
//
//                    hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                    //log_info << "dataspace_id: " << dataspace_id;
//
//                    //Modify dataset creation properties to enable chunking
//                    //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                    hid_t cparms;
//                    hsize_t chunk_dims[2] = {10, 3};
//                    cparms = H5Pcreate(H5P_DATASET_CREATE);
//                    H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                    //create dataset
//                    hid_t dataset_id = H5Dcreate(group_id, vectorFieldName.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                    //log_info << "dataset_id: " << dataset_id;
//
//
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCurrent->vectorFieldData[iVectorField].data());
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//
//                H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "boundaryCurrent")
//            {
//                RecordBoundaryCurrent* recordCurrent = static_cast<RecordBoundaryCurrent*>(record);
//                //create group
//                hid_t group_id = H5Gcreate(record_file_id, "boundaryCurrent", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //log_info << "boundaryCurrent group_id: " << group_id;
//                //exit(0);
//
//                //write for each species
//                int ibc = 0;
//                //log_info << "recordCurrent->emField->boundaryCurrentMap size: " << recordCurrent->emField->boundaryCurrentMap.size();
//                //log_info << std::endl;
//                for (auto iter = recordCurrent->emField->electric_potential->fbc_param.begin(); iter != recordCurrent->emField->electric_potential->fbc_param.end(); iter++)
//                {
//                    auto& boundaryName = iter->first;
//                    //log_info << "write record: " << boundaryName;
//
//                    //create space
//                    int n_dim = 1;
//                    hsize_t dims[1];
//                    dims[0] = config->sim_time->timestep_io;
//                    hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//                    hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                    //log_info << "dataspace_id: " << dataspace_id;
//
//                    //Modify dataset creation properties to enable chunking
//                    //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                    hid_t cparms;
//                    hsize_t chunk_dims[1] = { 10 };
//                    cparms = H5Pcreate(H5P_DATASET_CREATE);
//                    H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                    //create dataset
//                    hid_t dataset_id = H5Dcreate(group_id, boundaryName.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                    //log_info << "dataset_id: " << dataset_id;
//
//
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCurrent->data[ibc].data());
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//
//                    ibc++;
//                }
//
//                H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "boundaryElectricPotential")
//            {
//            RecordBoundaryElectricPotential* recordCurrent = static_cast<RecordBoundaryElectricPotential*>(record);
//            //create group
//            hid_t group_id = H5Gcreate(record_file_id, "boundaryElectricPotential", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//            //log_info << "boundaryCurrent group_id: " << group_id;
//            //exit(0);
//
//            //write for each species
//            int ibc = 0;
//            //log_info << "recordCurrent->emField->boundaryCurrentMap size: " << recordCurrent->emField->boundaryCurrentMap.size();
//            //log_info << std::endl;
//            for (auto iter = recordCurrent->emField->electric_potential->fbc_param.begin(); iter != recordCurrent->emField->electric_potential->fbc_param.end(); iter++)
//            {
//                auto& boundaryName = iter->first;
//                //log_info << "write record: " << boundaryName;
//
//                //create space
//                int n_dim = 1;
//                hsize_t dims[1];
//                dims[0] = config->sim_time->timestep_io;
//                hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//                hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                //log_info << "dataspace_id: " << dataspace_id;
//
//                //Modify dataset creation properties to enable chunking
//                //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                hid_t cparms;
//                hsize_t chunk_dims[1] = { 10 };
//                cparms = H5Pcreate(H5P_DATASET_CREATE);
//                H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                //create dataset
//                hid_t dataset_id = H5Dcreate(group_id, boundaryName.c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                //log_info << "dataset_id: " << dataset_id;
//
//
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCurrent->data[ibc].data());
//                H5Sclose(dataspace_id);
//                H5Dclose(dataset_id);
//
//                ibc++;
//            }
//
//            H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "electricPropulsion")
//            {
//                RecordThruster* recordThruster = static_cast<RecordThruster*>(record);
//                //create group
//                std::string groupName = record->record_param.recordType + "-" + record->record_param.faceGroupName;
//                hid_t group_id = H5Gcreate(record_file_id, groupName.c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//                //log_info << "boundaryCurrent group_id: " << group_id;
//                //exit(0);
//
//                for (int iItem = 0; iItem < recordThruster->itemNameList.size(); iItem++)
//                {
//
//                    //create space
//                    int n_dim = 1;
//                    hsize_t dims[1];
//                    dims[0] = config->sim_time->timestep_io;
//                    hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//                    hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//                    //log_info << "dataspace_id: " << dataspace_id;
//
//                    //Modify dataset creation properties to enable chunking
//                    //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//                    hid_t cparms;
//                    hsize_t chunk_dims[1] = { 10 };
//                    cparms = H5Pcreate(H5P_DATASET_CREATE);
//                    H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//                    //create dataset
//                    hid_t dataset_id = H5Dcreate(group_id, recordThruster->itemNameList[iItem].c_str(), H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//                    //log_info << "dataset_id: " << dataset_id;
//
//
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordThruster->data[iItem].data());
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//
//                }
//
//                H5Gclose(group_id);
//            }
//        }
//
//        //================================write record time=======================================
//            //create group
//        hid_t group_id = H5Gcreate(record_file_id, "time", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
//
//        //--------------------------------write simulationTime----------------------------------------
//        //create space
//        int n_dim = 1;
//        hsize_t dims[1];
//        dims[0] = config->sim_time->timestep_io;
//        hsize_t maxdims[1] = { H5S_UNLIMITED };
//
//        hid_t dataspace_id = H5Screate_simple(n_dim, dims, maxdims);
//        //log_info << "dataspace_id: " << dataspace_id;
//
//        //Modify dataset creation properties to enable chunking
//        //chunk���͵�hdf5�ļ��ֿ�洢��chunk_dims��ʾ���С
//        hid_t cparms;
//        hsize_t chunk_dims[1] = { 10 };
//        cparms = H5Pcreate(H5P_DATASET_CREATE);
//        H5Pset_chunk(cparms, n_dim, chunk_dims);
//
//        //create dataset
//        hid_t dataset_id = H5Dcreate(group_id, "simulationTime", H5T_NATIVE_DOUBLE, dataspace_id, H5P_DEFAULT, cparms, H5P_DEFAULT);
//        //log_info << "dataset_id: " << dataset_id;
//
//
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, recordCollection->simulationTime.data());
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(group_id);
//
//        H5Fclose(record_file_id);
//    }
//    //record file exists, write data
//    else
//    {
//        //log_info << "record size: " << recordCollection->recordList.size();
//        for (int iRecord = 0; iRecord < recordCollection->recordList.size(); iRecord++)
//        {
//            Record* record = recordCollection->recordList[iRecord];
//            record->iTimeStepRecord = 0;
//
//            if (record->record_param.recordType == "particleMacroNumber")
//            {
//                RecordParticleMacroNumber* recordCurrent = static_cast<RecordParticleMacroNumber*>(record);
//
//                //open group
//                hid_t group_id = H5Gopen2(record_file_id, "particleMacroNumber", H5P_DEFAULT);
//
//                //write for each species
//                for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//                {
//                    std::string speciesName = speciesCollection->species_list[iSpecies]->species_param.species_name;
//
//                    hid_t dataset_id = H5Dopen2(group_id, speciesName.c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 1)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[1];
//                    hsize_t dimsExtend[1];
//
//                    //get dims
//                    //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                    dims[0] = iTimePreviousOutput;
//
//                    dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    //get extended dataspace
//                    dataspace_id = H5Dget_space(dataset_id);
//
//                    //define parameters for hyperslab
//                    hsize_t offset[1];
//                    hsize_t count[1];
//
//                    offset[0] = dims[0];
//                    count[0] = config->sim_time->timestep_io;
//                    //log_info << "offset[0]: " << offset[0];
//                    //log_info << "count[0]: " << count[0];
//                    //log_info << recordCurrent->data[iSpecies][0];
//
//
//                    //select hyperslab
//                    H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                    //define memory space
//                    /* Create a memory dataspace to indicate the
//                    size of our buffer to be written in memory.
//                    The dimensions of the buffer do not change
//                    during code execution. */
//                    hsize_t dimsMem[1];
//                    dimsMem[0] = config->sim_time->timestep_io;
//                    hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                    //write dataset
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCurrent->data[iSpecies].data());
//                    H5Sclose(mem_space_id);
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//
//                }
//                H5Gclose(group_id);
//
//            }
//            else if (record->record_param.recordType == "particlePhysicalNumber")
//            {
//                RecordParticlePhysicalNumber* recordCurrent = static_cast<RecordParticlePhysicalNumber*>(record);
//
//                //open group
//                hid_t group_id = H5Gopen2(record_file_id, "particlePhysicalNumber", H5P_DEFAULT);
//
//                //write for each species
//                for (int iSpecies = 0; iSpecies < speciesCollection->species_list.size(); iSpecies++)
//                {
//                    std::string speciesName = speciesCollection->species_list[iSpecies]->species_param.species_name;
//
//                    hid_t dataset_id = H5Dopen2(group_id, speciesName.c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 1)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[1];
//                    hsize_t dimsExtend[1];
//
//                    //get dims
//                    //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                    dims[0] = iTimePreviousOutput;
//
//                    dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    //get extended dataspace
//                    dataspace_id = H5Dget_space(dataset_id);
//
//                    //define parameters for hyperslab
//                    hsize_t offset[1];
//                    hsize_t count[1];
//
//                    offset[0] = dims[0];
//                    count[0] = config->sim_time->timestep_io;
//                    //log_info << "offset[0]: " << offset[0];
//                    //log_info << "count[0]: " << count[0];
//                    //log_info << recordCurrent->data[iSpecies][0];
//
//
//                    //select hyperslab
//                    H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                    //define memory space
//                    /* Create a memory dataspace to indicate the
//                    size of our buffer to be written in memory.
//                    The dimensions of the buffer do not change
//                    during code execution. */
//                    hsize_t dimsMem[1];
//                    dimsMem[0] = config->sim_time->timestep_io;
//                    hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                    //write dataset
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCurrent->data[iSpecies].data());
//                    H5Sclose(mem_space_id);
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//
//                }
//                H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "fieldAtMonitorPoint")
//            {
//                RecordFieldAtMonitorPoint* recordCurrent = static_cast<RecordFieldAtMonitorPoint*>(record);
//
//                //open group
//                std::string groupNameString = "fieldAtMonitorPoint-" + record->record_param.recordName;
//                hid_t group_id = H5Gopen2(record_file_id, groupNameString.c_str(), H5P_DEFAULT);
//
//                //write sclar field
//                for (int iScalarField = 0; iScalarField < recordCurrent->scalarFieldData.size(); iScalarField++)
//                {
//                    std::string scalarFieldName = recordCurrent->scalarFieldList[iScalarField]->name;
//
//                    hid_t dataset_id = H5Dopen2(group_id, scalarFieldName.c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 1)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[1];
//                    hsize_t dimsExtend[1];
//
//                    //get dims
//                    //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                    dims[0] = iTimePreviousOutput;
//
//                    dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    //get extended dataspace
//                    dataspace_id = H5Dget_space(dataset_id);
//
//                    //define parameters for hyperslab
//                    hsize_t offset[1];
//                    hsize_t count[1];
//
//                    offset[0] = dims[0];
//                    count[0] = config->sim_time->timestep_io;
//                    //log_info << "offset[0]: " << offset[0];
//                    //log_info << "count[0]: " << count[0];
//                    //log_info << recordCurrent->data[iSpecies][0];
//
//
//                    //select hyperslab
//                    H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                    //define memory space
//                    /* Create a memory dataspace to indicate the
//                    size of our buffer to be written in memory.
//                    The dimensions of the buffer do not change
//                    during code execution. */
//                    hsize_t dimsMem[1];
//                    dimsMem[0] = config->sim_time->timestep_io;
//                    hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                    //write dataset
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCurrent->scalarFieldData[iScalarField].data());
//                    H5Sclose(mem_space_id);
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//
//                //write vector field
//                for (int iVectorField = 0; iVectorField < recordCurrent->vectorFieldData.size(); iVectorField++)
//                {
//                    std::string vectorFieldName = recordCurrent->vectorFieldList[iVectorField]->name;
//
//                    hid_t dataset_id = H5Dopen2(group_id, vectorFieldName.c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 2)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[2];
//                    hsize_t dimsExtend[2];
//
//                    //get dims
//                    //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                    dims[0] = iTimePreviousOutput;
//                    dims[1] = 3;
//
//                    dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//                    dimsExtend[1] = dims[1];
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    //get extended dataspace
//                    dataspace_id = H5Dget_space(dataset_id);
//
//                    //define parameters for hyperslab
//                    hsize_t offset[2];
//                    hsize_t count[2];
//
//                    offset[0] = dims[0];
//                    offset[1] = 0;
//                    count[0] = config->sim_time->timestep_io;
//                    count[1] = 3;
//                    //log_info << "offset[0]: " << offset[0];
//                    //log_info << "count[0]: " << count[0];
//                    //log_info << recordCurrent->vectorFieldData[iVectorField][0];
//
//
//                    //select hyperslab
//                    H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                    //define memory space
//                    /* Create a memory dataspace to indicate the
//                    size of our buffer to be written in memory.
//                    The dimensions of the buffer do not change
//                    during code execution. */
//                    hsize_t dimsMem[2];
//                    dimsMem[0] = config->sim_time->timestep_io;
//                    dimsMem[1] = 3;
//                    hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                    //write dataset
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCurrent->vectorFieldData[iVectorField].data());
//                    H5Sclose(mem_space_id);
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//                H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "boundaryCurrent")
//            {
//                RecordBoundaryCurrent* recordCurrent = static_cast<RecordBoundaryCurrent*>(record);
//
//                //open group
//                hid_t group_id = H5Gopen2(record_file_id, "boundaryCurrent", H5P_DEFAULT);
//
//                //write for each boundary
//                int ibc = 0;
//                for (auto iter = recordCurrent->emField->electric_potential->fbc_param.begin(); iter != recordCurrent->emField->electric_potential->fbc_param.end(); iter++)
//                {
//                    auto& boundaryName = iter->first;
//                    hid_t dataset_id = H5Dopen2(group_id, boundaryName.c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 1)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[1];
//                    hsize_t dimsExtend[1];
//
//                    //get dims
//                    //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                    dims[0] = iTimePreviousOutput;
//
//                    dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    //get extended dataspace
//                    dataspace_id = H5Dget_space(dataset_id);
//
//                    //define parameters for hyperslab
//                    hsize_t offset[1];
//                    hsize_t count[1];
//
//                    offset[0] = dims[0];
//                    count[0] = config->sim_time->timestep_io;
//                    //log_info << "offset[0]: " << offset[0];
//                    //log_info << "count[0]: " << count[0];
//                    //log_info << recordCurrent->data[ibc][0];
//
//
//                    //select hyperslab
//                    H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                    //define memory space
//                    /* Create a memory dataspace to indicate the
//                    size of our buffer to be written in memory.
//                    The dimensions of the buffer do not change
//                    during code execution. */
//                    hsize_t dimsMem[1];
//                    dimsMem[0] = config->sim_time->timestep_io;
//                    hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                    //write dataset
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCurrent->data[ibc].data());
//                    H5Sclose(mem_space_id);
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//
//
//                    ibc++;
//                }
//
//                H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "boundaryElectricPotential")
//            {
//            RecordBoundaryElectricPotential* recordCurrent = static_cast<RecordBoundaryElectricPotential*>(record);
//
//            //open group
//            hid_t group_id = H5Gopen2(record_file_id, "boundaryElectricPotential", H5P_DEFAULT);
//
//            //write for each boundary
//            int ibc = 0;
//            for (auto iter = recordCurrent->emField->electric_potential->fbc_param.begin(); iter != recordCurrent->emField->electric_potential->fbc_param.end(); iter++)
//            {
//                auto& boundaryName = iter->first;
//                hid_t dataset_id = H5Dopen2(group_id, boundaryName.c_str(), H5P_DEFAULT);
//
//                //get dataspace_id
//                hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                //get rank: n_dim
//                int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                if (n_dim != 1)
//                {
//                    log_error << "n_dim: " << n_dim;
//                    //exit(0);
//                }
//
//                hsize_t dims[1];
//                hsize_t dimsExtend[1];
//
//                //get dims
//                //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                dims[0] = iTimePreviousOutput;
//
//                dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//
//                //extend dataset
//                H5Dextend(dataset_id, dimsExtend);
//
//                //get extended dataspace
//                dataspace_id = H5Dget_space(dataset_id);
//
//                //define parameters for hyperslab
//                hsize_t offset[1];
//                hsize_t count[1];
//
//                offset[0] = dims[0];
//                count[0] = config->sim_time->timestep_io;
//                //log_info << "offset[0]: " << offset[0];
//                //log_info << "count[0]: " << count[0];
//                //log_info << recordCurrent->data[ibc][0];
//
//
//                //select hyperslab
//                H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                //define memory space
//                /* Create a memory dataspace to indicate the
//                size of our buffer to be written in memory.
//                The dimensions of the buffer do not change
//                during code execution. */
//                hsize_t dimsMem[1];
//                dimsMem[0] = config->sim_time->timestep_io;
//                hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                //write dataset
//                H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCurrent->data[ibc].data());
//                H5Sclose(mem_space_id);
//                H5Sclose(dataspace_id);
//                H5Dclose(dataset_id);
//
//
//                ibc++;
//            }
//
//            H5Gclose(group_id);
//            }
//            else if (record->record_param.recordType == "electricPropulsion")
//            {
//                RecordThruster* recordThruster = static_cast<RecordThruster*>(record);
//
//                //open group
//                std::string groupName = record->record_param.recordType + "-" + record->record_param.faceGroupName;
//                hid_t group_id = H5Gopen2(record_file_id, groupName.c_str(), H5P_DEFAULT);
//
//
//                for (int iItem = 0; iItem < recordThruster->itemNameList.size(); iItem++)
//                {
//                    hid_t dataset_id = H5Dopen2(group_id, recordThruster->itemNameList[iItem].c_str(), H5P_DEFAULT);
//
//                    //get dataspace_id
//                    hid_t dataspace_id = H5Dget_space(dataset_id);
//
//                    //get rank: n_dim
//                    int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//                    if (n_dim != 1)
//                    {
//                        log_error << "n_dim: " << n_dim;
//                        //exit(0);
//                    }
//
//                    hsize_t dims[1];
//                    hsize_t dimsExtend[1];
//
//                    //get dims
//                    //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//                    dims[0] = iTimePreviousOutput;
//
//                    dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//
//                    //extend dataset
//                    H5Dextend(dataset_id, dimsExtend);
//
//                    //get extended dataspace
//                    dataspace_id = H5Dget_space(dataset_id);
//
//                    //define parameters for hyperslab
//                    hsize_t offset[1];
//                    hsize_t count[1];
//
//                    offset[0] = dims[0];
//                    count[0] = config->sim_time->timestep_io;
//                    //log_info << "offset[0]: " << offset[0];
//                    //log_info << "count[0]: " << count[0];
//
//
//                    //select hyperslab
//                    H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//                    //define memory space
//                    /* Create a memory dataspace to indicate the
//                    size of our buffer to be written in memory.
//                    The dimensions of the buffer do not change
//                    during code execution. */
//                    hsize_t dimsMem[1];
//                    dimsMem[0] = config->sim_time->timestep_io;
//                    hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//                    //write dataset
//                    H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordThruster->data[iItem].data());
//                    H5Sclose(mem_space_id);
//                    H5Sclose(dataspace_id);
//                    H5Dclose(dataset_id);
//                }
//
//                H5Gclose(group_id);
//            }
//
//        }
//
//        //================================write record time=======================================
//        //open group
//        hid_t group_id = H5Gopen2(record_file_id, "time", H5P_DEFAULT);
//
//        //--------------------------------write simulationTime----------------------------------------
//        hid_t dataset_id = H5Dopen2(group_id, "simulationTime", H5P_DEFAULT);
//
//        //get dataspace_id
//        hid_t dataspace_id = H5Dget_space(dataset_id);
//
//        //get rank: n_dim
//        int n_dim = H5Sget_simple_extent_ndims(dataspace_id);
//        if (n_dim != 1)
//        {
//            log_error << "n_dim: " << n_dim;
//            exit(0);
//        }
//
//        hsize_t dims[1];
//        hsize_t dimsExtend[1];
//
//        //get dims
//        //H5Sget_simple_extent_dims(dataspace_id, dims, NULL);
//        dims[0] = iTimePreviousOutput;
//
//        dimsExtend[0] = dims[0] + config->sim_time->timestep_io;
//        if (config->debugLevel > 1) log_warning << "dims[0]: " << dims[0] << " timestep_io: " << config->sim_time->timestep_io << " dimsExtend[0]: " << dimsExtend[0];
//
//        //extend dataset
//        H5Dextend(dataset_id, dimsExtend);
//
//        //get extended dataspace
//        dataspace_id = H5Dget_space(dataset_id);
//
//        //define parameters for hyperslab
//        hsize_t offset[1];
//        hsize_t count[1];
//
//        offset[0] = dims[0];
//        count[0] = config->sim_time->timestep_io;
//        if (config->debugLevel > 1) log_info << "offset[0]: " << offset[0];
//        if (config->debugLevel > 1) log_info << "count[0]: " << count[0];
//
//
//        //select hyperslab
//        H5Sselect_hyperslab(dataspace_id, H5S_SELECT_SET, offset, NULL, count, NULL);
//
//        //define memory space
//        /* Create a memory dataspace to indicate the
//        size of our buffer to be written in memory.
//        The dimensions of the buffer do not change
//        during code execution. */
//        hsize_t dimsMem[1];
//        dimsMem[0] = config->sim_time->timestep_io;
//        hid_t mem_space_id = H5Screate_simple(n_dim, dimsMem, NULL);
//
//
//        //write dataset
//        H5Dwrite(dataset_id, H5T_NATIVE_DOUBLE, mem_space_id, dataspace_id, H5P_DEFAULT, recordCollection->simulationTime.data());
//        H5Sclose(mem_space_id);
//        H5Sclose(dataspace_id);
//        H5Dclose(dataset_id);
//
//        H5Gclose(group_id);
//
//        H5Fclose(record_file_id);
//
//    }
//
//    isFirstTime = false;
//
//    iTimePreviousOutput = config->sim_time->itime;
//
//}
//
//void IO::getElectricPotentialBoundaryField()
//{
//    if (!config->sim_time->is_time_io() || !config->pmpi->is_master())
//    {
//        return;
//    }
//
//    //log_info << "111";
//    Field<double>* electric_potential = config->emField->electric_potential;
//    BoundaryFieldCollection<double>* electricPotentialBoundaryFieldCollection = config->emField->electricPotentialBoundaryFieldCollection;
//    EasyMesh::Mesh* serialMesh = config->mesh->serialMesh;
//
//    //log_info << "222";
//    for (auto iter = electricPotentialBoundaryFieldCollection->boundaryFieldMap.begin(); iter != electricPotentialBoundaryFieldCollection->boundaryFieldMap.end(); iter++)
//    {
//        auto& boundaryName = iter->first;
//        auto& boundaryField = iter->second;
//
//        if (config->dimension == 3)
//        {
//            auto& faceGroup = serialMesh->faceGroupMap.find(boundaryName)->second;
//            for (int iFace = 0; iFace < faceGroup.faceList.size(); iFace++)
//            {
//                int iFaceGlobal = faceGroup.faceList[iFace];
//                auto& face = serialMesh->faceList[iFaceGlobal];
//
//                double electricPotentialTemp = 0.0;
//                for (int iPoint = 0; iPoint < 3; iPoint++)
//                {
//                    int iPointGlobal = face.pointList[iPoint];
//                    electricPotentialTemp += electric_potential->data_global[iPointGlobal];
//                }
//                boundaryField.data_average_global[iFace] = electricPotentialTemp / 3.0;
//            }
//
//        }
//        else if (config->dimension == 2)
//        {
//            //log_info << "333 " << boundaryName;
//            auto& lineGroup = serialMesh->lineGroupMap.find(boundaryName)->second;
//            for (int iLine = 0; iLine < lineGroup.lineList.size(); iLine++)
//            {
//                int iLineGlobal = lineGroup.lineList[iLine];
//                auto& line = serialMesh->lineList[iLineGlobal];
//
//                double electricPotentialTemp = 0.0;
//                for (int iPoint = 0; iPoint < 2; iPoint++)
//                {
//                    int iPointGlobal = line.pointList[iPoint];
//                    electricPotentialTemp += electric_potential->data_global[iPointGlobal];
//                }
//                boundaryField.data_average_global[iLine] = electricPotentialTemp / 2.0;
//            }
//        }
//        else
//        {
//            log_error << "the dimension not support: " << config->dimension;
//            exit(0);
//        }
//        
//        //log_info << "666";
//        
//    }
//    //log_info << "777";
//}